Platform SDK: CDO for Windows 2000 |
You can use the Rule property in each event binding's Source property bag to further refine conditions in which a sink is notified of an event. These rules are made up of protocol conditions that must match the protocol commands that are sent when the message (or the appropriate header) is submitted to the bound sink that will be notified. The conditions themselves are case-insensitive patterns, and can include * wildcards. The format of each rule is as follows:
<command> = <pattern>
You can have multiple conditions in a single rule, separated by semicolons:
<command1>=<pattern>;<command2>=<pattern2>
For sinks bound to SMTP OnArrival events, you can define rules that must match the EHLO, MAIL FROM, or RCPT TO protocol commands. If the message arrives in the pickup directory, the MAIL FROM command is derived from either the Sender message header. if present, or the From message header. The RCPT TO command comes from the To, CC and BCC headers for the message.
When creating conditions for the MAIL FROM or RCPT TO protocol commands, you match e-mail addresses. E-mail address patterns consist of two parts—a name and a host and domain:
<name pattern>[@domain pattern>]
The brackets indicate the optional host and domain portion of the address. The name pattern conditions are structured as follows:
<name pattern> := { * | [*]<email name>[*]}
For example,
* ' any name *user ' any name ending with "user" user* ' any name starting with "user" *user* ' any name containing the string "user"
Domain pattern conditions are structured as follows:
<domain pattern> := [*][<domain name>]
For example,
* ' matches any domain microsoft.com ' exactly matches microsoft.com *microsoft.com ' any domain that ends with microsoft.com, including "microsoft.com"
When creating rules for the EHLO command, only use the domain condition.
Here are some complete examples of various SMTP conditions:
MAIL FROM=* ' match any email address RCPT TO=person@microsoft.com ' match person@microsoft.com exactly RCPT TO=person@*microsoft.com ' match person@anywhere.microsoft.com MAIL FROM=*person ' match anyperson@microsoft.com RCPT TO=name*@*soft.com ' match <anything>@<any>.microsoft.com EHLO=microsoft.com ' match EHLO microsoft.com EHLO=*microsoft.com ' match EHLO from <any>.microsoft.com EHLO=* ' not very useful, but causes all messages to fire events.
Note that all conditions are case-insensitive. That is
mail from=user same as MAIL from=USER same as MAIL FROM=UsEr
Multiple conditions can be set for each rule, separated by a semicolon. For example,
Mail From=*@fake.microsoft.com;EHLO=fake.microsoft.com;RCPT TO=Group*@*microsoft.com
This rule runs only if:
For sinks bound to NNTP OnPost, OnPostEarly, and OnPostFinal events, you can define rules that must match the message's Newsgroups, subject, organization, and control mail header field values:
Newsgroups=* Newsgroups=alt.* Sender=*@microsoft.com Subject=* Organization=* control=*
As demonstrated earlier, you can use * wildcards for the entire newsgroup name or portions of the name. Note that the NNTP sink binding rules are not based upon protocol commands; they are based upon mail header fields present in each message.