spam.assassin.prefs.conf ruleset

James Gray james_gray at OCS.COM
Tue May 4 23:17:43 IST 2004


On Tue, 4 May 2004 07:54 am, Mariano Absatz wrote:
> Hi,
>
> one of the setups I have is an old MS 4.23-11 with SpamAssassin 2.63.
>
> It works quite nice, but I had a request from a group of people to use a
> special set of SA scores with some (only some) of the scores changed from
> the default 50_scores.cf.
>
> That seemed like a fit situation for rulesets, so I copied my
> spam.assasssin.prefs.conf to spam.assassin.prefs-other.conf and made a
> simple ruleset named spam.assassin.prefs.rules that says:
>
> To: someone at example.com      spam.assassin.prefs-other.conf
> To: anotherone at example.com   spam.assassin.prefs-other.conf
> FromOrTo: default            spam.assassin.prefs.rules

You could implement this in a single SpamAssassin rule file using meta rules.
You have said there are only a few rules that you are changing the score of
so try  this:

header __TO_CUST_SCORE1     To =~ /someone\@example\.com/i
header __TO_CUST_SCORE2     To =~ /anotherone\@example\.com/i
meta CUST_SCORE1            (__TO_CUST_SCORE1 && SA_TEST_NAME)
meta CUST_SCORE2            (__TO_CUST_SCORE2 && SA_TEST_NAME)
describe CUST_SCORE1        Custom score for someone at example.com
describe CUST_SCORE2        Custom score for anotherone at example.com
score CUST_SCORE1           x.y
score CUST_SCORE2           a.b

You get the idea?  the problem is that if you had 3 users who wanted the score
of 3 rules changed that would (at worst) result in 9 separate rules and
scores :(

You can combine common rules/users with the OR operator which is two vertical
bars (||) and the NOT operator (!) can be combined to negate rules like this:

meta FOO      (RULE_1 && !RULE_2)
returns true if RULE_1 is true and RULE_2 is false.

meta FOO      (!RULE_1 || RULE_2)
returns true is RULE_1 is false or RULE_2 is true.

By prefixing a rule with two underscores like __FOO_RULE tells spamassassin
not to associate a score with it.  Useful for "meta" rules which combine a
number of matches (rules) to create a more complex rule that combines
body/header/uri/subject elements etc.

All this stuff is in the spamassassin.conf documentation :)

Good luck.

James

-------------------------- MailScanner list ----------------------
To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/     and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html



More information about the MailScanner mailing list