Platform SDK: CDO for Windows 2000

Registering Script Sink Bindings

The CDO COM libraries provide COM classes that can be used as scripting hosts for sink code written in scripting languages with locally installed scripting engines. You register the appropriate CDO scripting host COM class as the actual NNTP or SMTP event sink in a binding, and you add configuration information to the binding's Sink property bag that specifies the path of the script to run. The following table lists the programmatic identifiers for the scripting host event sinks.

Event Sink Scripting Host Programmatic Identifier

Event Programmatic identifier
OnArrival CDO.SS_SMTPOnArrivalSink
OnPostEarly CDO.SS_NNTPOnPostEarlySink
OnPost CDO.SS_NNTPOnPostSink
OnPostFinal CDO.SS_NNTPOnPostFinalSink

Once you have bound the appropriate scripting host as the event sink, you need to set the ScriptName property in the binding's Sink property bag. This property should contain the local path to the script that contains the various routines. Use quotes around the path for this argument. Note that the display name arguments are case-sensitive.

Example

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"

cscript nntpreg.vbs /add     1 onpost NNTPOnPostScriptingHost CDO.SS_NNTPOnPostSink "newsgroups=*"
cscript nntpreg.vbs /setprop 1 onpost NNTPOnPostScriptingHost Sink ScriptName "c:\path\to\sinkscript.vbs"

You can use the same script file for multiple bindings and multiple events; therefore, you can put handling code for the SMTP OnArrival event and the NNTP OnPost, OnPostEarly, and OnPostFinal events in the same file. Create a binding for each event and set the ScriptName property for each binding to point to the same file location.

See Also

Implementing Sinks with Scripting Languages