Page 61 - Mercury Manual.book
P. 61
Content Control 56
Mercury's Content Control Filtering Language
Example: IF BODY HAS "Fuck, Shit" Weight 100 Tag "Rude language"
In this example, when Mercury prepares the X-CC-Diagnostic header in the message, it
will format it as Rude language (100) instead of Body Has "Fuck, Shit" (100),
which may be offensive to some people.
Tags are optional, and can appear instead of or after a WEIGHT statement. The name param-
eter to a Tag statement must always appear in double-quote marks, as shown in the example
above.
General layout
The rule language itself is not case-sensitive, so the following tests are both semantically val-
id:
If Sender contains "foobar" weight 80
IF SENDER CONTAINS "foobar" WEIGHT 80
Furthermore, whitespace is ignored, so you can layout your tests in whatever way you feel is
clearest: as an example, the following is a completely syntactically valid test:
If
sender contains
"Foobar"
Weight 80
The only restriction is that neither a string nor a keyword can cross a line boundary; so, the
following test is invalid:
If sender con
tains foobar Weight 80
Examples:
1: To detect a message where the sender's address contains "spam.com"
IF SENDER CONTAINS "spam.com" WEIGHT 50
2: To detect a message where the sender's address contains "spam.com" and the body of the
mesage contains the word "viagra"
IF SENDER CONTAINS "spam.com"
AND BODY CONTAINS "viagra" WEIGHT 50
3: To detect a message where the sender's address contains "spam.com" and either the subject
field or the message body contains the word "viagra"
IF SENDER CONTAINS "spam.com"
AND SUBJECT CONTAINS "viagra"
OR BODY CONTAINS "viagra" WEIGHT 50
4: To detect a message where the sender's address contains "spam.com", the message has no
"Date" header, and the Subject or the Body contains "viagra"
IF SENDER CONTAINS "spam.com"
ANDNOT EXISTS "Date"
AND SUBJECT CONTAINS "viagra"
OR BODY CONTAINS "viagra" WEIGHT 50