Hi, My goal is to make a log file when new mail comes to exchange server. So, I have installed Exchange in my machine and I have created a script file called Sinkscript.vbs which is located in the following path (C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts\Sinkscript.vbs) The file contains the following code. -------- <SCRIPT LANGUAGE="VBScript"> cdoRunNextSink=0 Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus ) Dim fs Set fs = Create("Scripting.FileSystemObject") Dim file Set file = fs.OpenTextFile("D:\script\text.log", 8) file.write "----------------new mail---------------" file.Write "From: " & Msg.From & vbCrLf file.Write "To: " & Msg.To & vbCrLf file.Write "Subject: " & Msg.Subject & vbCrLf & vbCrLf file.Write Msg.TextBody & vbCrLf & vbCrLf file.write "----------------End--------------------" file.Close EventStatus = cdoRunNextSink End Sub </SCRIPT> ----------------------- I have created a log file D:\script\text.log and I have registered the sink as follows. Cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail from=*" cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts\Sinkscript.vbs" I have created two mail ids in my exchange server. Then I stopped and started the SMTP server. I am sending and receiving mails locally for each IDs, it is working. But my log file is not getting updated. I need a urgent help in this regard. Thank you Aambal
SMTP sinks don't fire on Internal mail traffic (mail between two users on the same server) you need to send something where mail is going to be processed by the SMTP server (External Outbound or Inbound mail). Eg use Outlook Express locally to send a message to any of the mailboxes on your server via SMTP Cheers Glen "Aambal" wrote in message news:517DB4F4-1202-4329-B81E-B12BAF29D6E1@microsoft.com... > Hi, > My goal is to make a log file when new mail comes to exchange server. > So, > I have installed Exchange in my machine and I have created a script file > called Sinkscript.vbs which is located in the following path > (C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts\Sinkscript.vbs) > The file contains the following code. > -------- > <SCRIPT LANGUAGE="VBScript"> > cdoRunNextSink=0 > Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus ) > > Dim fs > Set fs = Create("Scripting.FileSystemObject") > Dim file > Set file = fs.OpenTextFile("D:\script\text.log", 8) > file.write "----------------new mail---------------" > file.Write "From: " & Msg.From & vbCrLf > file.Write "To: " & Msg.To & vbCrLf > file.Write "Subject: " & Msg.Subject & vbCrLf & vbCrLf > file.Write Msg.TextBody & vbCrLf & vbCrLf > file.write "----------------End--------------------" > file.Close > EventStatus = cdoRunNextSink > End Sub > </SCRIPT> > ----------------------- > I have created a log file D:\script\text.log and I have registered the > sink > as follows. > > Cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost > CDO.SS_SMTPOnArrivalSink "mail from=*" > cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName > "C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts\Sinkscript.vbs" > > I have created two mail ids in my exchange server. Then I stopped and > started the SMTP server. I am sending and receiving mails locally for each > IDs, it is working. But my log file is not getting updated. > > I need a urgent help in this regard. > > Thank you > > Aambal
Thank you very much Glen . my code is getting fired now. Aambal "Glen Scales [MVP]" wrote: > SMTP sinks don't fire on Internal mail traffic (mail between two users on > the same server) you need to send something where mail is going to be > processed by the SMTP server (External Outbound or Inbound mail). Eg use > Outlook Express locally to send a message to any of the mailboxes on your > server via SMTP > > Cheers > Glen > > "Aambal" wrote in message > news:517DB4F4-1202-4329-B81E-B12BAF29D6E1@microsoft.com... > > Hi, > > My goal is to make a log file when new mail comes to exchange server. > > So, > > I have installed Exchange in my machine and I have created a script file > > called Sinkscript.vbs which is located in the following path > > (C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts\Sinkscript.vbs) > > The file contains the following code. > > -------- > > <SCRIPT LANGUAGE="VBScript"> > > cdoRunNextSink=0 > > Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus ) > > > > Dim fs > > Set fs = Create("Scripting.FileSystemObject") > > Dim file > > Set file = fs.OpenTextFile("D:\script\text.log", 8) > > file.write "----------------new mail---------------" > > file.Write "From: " & Msg.From & vbCrLf > > file.Write "To: " & Msg.To & vbCrLf > > file.Write "Subject: " & Msg.Subject & vbCrLf & vbCrLf > > file.Write Msg.TextBody & vbCrLf & vbCrLf > > file.write "----------------End--------------------" > > file.Close > > EventStatus = cdoRunNextSink > > End Sub > > </SCRIPT> > > ----------------------- > > I have created a log file D:\script\text.log and I have registered the > > sink > > as follows. > > > > Cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost > > CDO.SS_SMTPOnArrivalSink "mail from=*" > > cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName > > "C:\Program Files\Exchange SDK\SDK\Support\CDO\Scripts\Sinkscript.vbs" > > > > I have created two mail ids in my exchange server. Then I stopped and > > started the SMTP server. I am sending and receiving mails locally for each > > IDs, it is working. But my log file is not getting updated. > > > > I need a urgent help in this regard. > > > > Thank you > > > > Aambal > > >