Page 58 - Mercury Manual.book
P. 58
53 Content Control
Mercury's Content Control Filtering Language
detect the X-AC-Weight header and take appropriate actions. Like the X-UC-Weight header
(see above), The X-AC-Weight header is graphical, in that it contains a little graph that in-
dicates how acceptable the message actually was. The graph consists of one to four hash char-
acters, with the same meanings as in the X-UC-Weight graph above, except that the values
are negative: so, [### ] would mean that the weight of the message is less than (3 * the ac-
tivation weight * -1). Similarly, [####] means that the message has been explicitly whitelist-
ed, or has a value lower than -9990.
Add a diagnostic header showing which rules were matched When this control is checked
and a rule generates any non-zero value after Content Control processing, Mercury will insert
a header called X-CC-Diagnostic into the message: this header contains a summary of the
rules that triggered during processing, and is a useful way of working out why a message was
given the weight it received. Each rule is written into the header in an abbreviated form, un-
less it has a Tag defined, in which case the tag is written into the header instead. For each rule
written, the weight associated with that rule is shown in brackets as well.
Mercury's Content Control Filtering Language
Mercury's content control rule language has been designed to be simple and flexible: it is
based on the use of regular expressions, which describe patterns of text within the message.
A rule set consists of a sequence of tests applied sequentially to the message.
The types of test
Body and subject tests these tests look for content in either the subject field or the body of
the mail message. There are two types of test - a substring test, using the CONTAINS operator,
and a regular expression test, using the MATCHES operator. The substring test simply looks
for a group of characters anywhere in the specified location, while a regular expression test
looks for more complex patterns of characters. See below for more information on the differ-
ence between substring and regular expression tests.
IF SUBJECT CONTAINS "string" WEIGHT x
IF SUBJECT MATCHES "regular_expression" WEIGHT x
IF BODY CONTAINS "string" WEIGHT x
IF BODY MATCHES "regular_expression" WEIGHT x
If you want to test for a string or a pattern in either the body or the subject field, you can use
the CONTENT test instead - this checks in both places automatically:
IF CONTENT CONTAINS "string" WEIGHT x
IF CONTENT MATCHES "regular_expression" WEIGHT x
Header tests these tests check specific headers or groups of headers in the mail message.
The SENDER test looks in the "From", "Sender", "Resent-From" and "Reply-to" fields of the
message, while the RECIPIENT test looks in the "To", "CC", "BCC" and "Resent-To", fields.
The HEADER test allows you to check any single header in the message: if the header does not
exist, the test does not trigger. Finally, the EXISTS test allows you to check whether or not a
specific header exists in the message.
IF SENDER CONTAINS "string" WEIGHT x
IF SENDER MATCHES "regular_expression" WEIGHT x
IF RECIPIENT CONTAINS "string" WEIGHT x
IF RECIPIENT MATCHES "regular_expression" WEIGHT x
IF HEADER "headername" CONTAINS "string" WEIGHT x