Tom Jones
Guest
|
Posted:
Sat Nov 13, 2004 1:40 am Post subject:
Event Sinks... |
|
|
I am having some trouble getting event sinks to work here is my setup.
I have a P4 Computer that has Win2k3 Standard and exchange 2k3 standard on
it.
I have created 3 different types of sinks and neither of them fire. Here is
the code I have for a VBS event sink.
Code---
<SCRIPT LANGUAGE="VBScript">
Sub IEventIsCacheable_IsCacheable
' just returns S_OK
End Sub
Sub ISMTPOnArrival_OnArrival(ByVal iMsg, EventStatus )
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set wFile = fso.OpenTextFile("c:\OnSave_Log.txt", 8, True)
wfile.WriteLine ("Event Sink Fired at " & Now)
wfile.WriteLine ("Script fired by me")
EventStatus =0
End Sub
</SCRIPT>
I register it using the following commands.
cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost
CDO.SS_SMTPOnArrivalSink "mail from=*"
cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName
"C:\NewMail.vbs"
I am testing sending emails to exchange using the following C# code.
try
{
MailMessage msg=new MailMessage();
msg.To="testuser1@testdomain.test";
msg.From ="testuser1@testdomain.test";
msg.Subject ="Test Email";
msg.Body ="Test Body";
SmtpMail.SmtpServer ="the ip of the exchange box";
SmtpMail.Send(msg);
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
Any help would be nice.
|
|