Monday, December 3, 2007

How to write custom rules for spamassassin

How to configure the spam filter for custom rules

do you really need to do this?

answer: if the customer is getting spam that is solicted or unsolicted and it is not marked spam and the customer is concerned, then yes. It is best to leave the filter alone until really needed because the kind of change you will be making will be global

* Ssh into your mail server and gain root privileges
* edit /etc/mail/spamassassin/local.cf
* add filters to the bottom of the file indicating your filter text
* here is an example that would work for marking email containing the phrase "foo bar is king" as spam:

body NO_FOO /foo bar is king/i

score NO_FOO 5.0

* save off local.cf
* restart the spam filter as such:

/etc/init.d/spampd restart (this depends on your implementation)