The Mail Filter
The Mail Filter can be used to sort your incoming mail into separate folders or to immediately delete mails (such as “Spam”) which match the filter rules which you have pre-defined. The Mail Filter allows you to define individual rules for each email account on your server. A predefined set of simple standard filter rules matching common Spam characteristics can be installed initially.
Each filter should have a meaningful description and can either match the mail header, the mail body or both. Multiline Filter rules are ANDed.
The following regular expression tokens are allowed in filter rules:
^ – Start of a line.
$ – End of a line.
. – Any character except a newline.
a* – Any sequence of zero or more a’s.
a+ – Any sequence of one or more a’s.
a? – Either zero or one a.
[^-a-d] – Any character which is not either a dash, a, b, c, d or newline.
de|abc – Either the sequence `de’ or `abc’.
(abc)* – Zero or more times the sequence `abc’.
The “!” character at the beginning of a filter rule inverts the condition.
Examples:
^.*(cash|dollar|visit)
This rule catches all mails containing either the word “cash”, “dollar” or “visit” in the selected part of the mail.
^.*(cash|dollar|visit)
!^From:.*domain.com
This rule catches all mails containing either the word “cash”, “dollar” or “visit” in the selected part of the mail which are NOT coming from domain.com.
Filter rules are processed in the displayed order.
A first rule like
^Subject:.*(spamcop|uunet|spam from)
which is sending mails to a valid mailbox will make sure that site or server related spam alerts will be delivered.
Additional examples are available with the preinstallable standard filters.
The Mail Filter system is based on procmail. Global settings can be located in the /etc/procmailrc file.
More information is available in the procmail man pages (command “man procmail” on your server). For more information on setting up Procmail Spam filter rules search “procmail spam filter rules” on Google or see the following URL:
http://www.uwasa.fi/~ts/info/proctips.html