Page 52 - Mercury Manual.book
P. 52
47 Mail Filtering Rules
Advanced rule processing options
sequence should have the action you want applied to the message. When using this approach,
Mercury will skip any remaining rules in the sequence as soon as any condition fails, and will
continue processing at the first rule after the last rule in the sequence. When using Logical
AND actions in this way, be careful if you rearrange the order of your rules, since breaking
the sequence of Logical AND rules will almost certainly result in undesirable matches occur-
ring. Mercury also provides two other ways of performing AND operations: the simpler form
allows you to match exactly two conditions, using the Skip next rule action. To do this, you
simply use the Skip next rule action on the first rule in the pair if the data does NOT match
the first condition, then apply the action you want in the second rule only if the second rule
DOES match the second condition. For instance, in the following example, we want to delete
the message only if the subject field contains free offer and the from field contains al-
iensales.com.
If "Subject" field does not contain "free offer" then skip next rule
If "From" field contains "aliensales.com" then delete message
The more complex approach to matching multiple conditions depends on using a call state-
ment to transfer to a group of rules where each rule returns if it does not contain the required
text. This approach requires more setup, but allows you to match on an unlimited number of
conditions. For instance, say we want to play a sound when we get a message from anyone
at compuserve.com where the subject line contains the word Transylvania but not the
word vampire, and the To: field contains the address foo@bar.com: to achieve this, we
would create the following rules in our rule set -
If "From" field contains "compuserve.com" then call label next-test
[... other normal rules are here...]
Label next-test
If "Subject" field does not contain "Transylvania" then return from call
If "Subject" field contains "vampire" then return from call
If "To" field does not contain "foo@bar.com" then return from call
Always play sound "tada.wav"
Always return from call