The least complex rules are the body and header rules. Meta rules are more complex and are described later in the chapter.
All rules must implement a Perl regex. If a rule is defined, it will be run unless its score is set to 0. The default score for a rule is 1.0. Rules beginning with T_
are test rules, and SpamAssassin gives a default score of 0.01 to these. Rule names should be 22 characters or less. By convention, rule names are in uppercase.
A rule must also have a description. The describe
configuration directive is used for this.
Rules should be placed in a file with the extension .cf
and placed in /etc/mail/spamassassin
. Rules can only be defined for a user if allow_local_rules
is set in /etc/mail/spamassassin/local.cf:
allow_local_rules 1
User-defined rules are placed in ~/.spamassassin/user_prefs
. Rules can be developed using a user account. Once a rule is tested and scored, it can be moved to the site-wide configuration.
Rules can be written to search for single words...