Platform SDK: CDO for Windows 2000

Enabling or Disabling a Binding

After you create an event binding, you can explicitly enable or disable it. When the binding is disabled, the event dispatcher ignores the binding. The syntax for enabling or disabling the event binding is as follows;

cscript [smtpreg | nntpreg].vbs 
                           /enable | /disable
                           instance
                           event
                           display name
instance
The number of the NNTP or SMTP virtual server instance; for example, 1.
event
The event for which you are registering the sink. For the SMTP event service, the value must be OnArrival. For the NNTP event service, the values are OnPost, OnPostFinal, and OnPostEarly. These values are case-insensitive. Quotes around the event name are optional.
display name
The display name of the sink. When using the scripts, each binding should have a unique display name for each virtual server instance and event. The display names are case-sensitive. Use quotes around the name if it contains spaces.

Example

This example demonstrates how to create bindings and then disable them immediately.

cscript smtpreg.vbs /add     1 onarrival MyGeneralSink MyStuff.MySink  "mail from=*"
cscript smtpreg.vbs /disable 1 onarrival MyGeneralSink

cscript nntpreg.vbs /add     1 onpost MyPostSink   MyStuff.MySink2 "newsgroups=*"
cscript nntpreg.vbs /disable 1 onpost MyPostSink

Then you can enable the bindings as follows:

cscript smtpreg.vbs /enable 1 onarrival MyGeneralSink
cscript nntpreg.vbs /enable 1 onpost MyPostSink