| W2K includes and SMTP mail server as an optional component of Internet services. You can register VBScript files to process SMTP server events such as a new mail arriving. The script gets full access to the contents of the message and the header information. Before trying to use the process I about to describe you should ensure that your SMTP server is configured and able to receive email which should be located in the xxx directory. You can use Outlook Express on the SMTP server to create email messages by creating a mail account that uses 127.0.0.1 as the SMTP and POP address (even though the server doesn't support POP, OE requires that you enter something). Event scripts are saved as .vbs files just like WSH but they must contain the script language block tags language=VBScript> Sub ISMTPOnArrival_OnArrival( ByVal Msg, Status) ' sink code here End Sub </SCRIPT> Microsoft provides a WSH script to register for SMTP events which I have included in the download section. Command to register your script... cscript smtpreg.vbs /add 1 onarrival SMTPScriptingHost CDO.SS_SMTPOnArrivalSink "mail from=*" cscript smtpreg.vbs /setprop 1 onarrival SMTPScriptingHost Sink ScriptName "c:\path\to\sinkscript.vbs" I have also included a sample script that will log information on each message received to a text file. You can find more information on MSDN. |