How can I create rules for spam assassin: if the [subject/email/body/anywhere] contains [spam terms] [move to spam]
lammert
9:38 pm on May 1, 2010 (gmt 0)
SpamAssassin can be trained on spam and ham messages with the sa-learn tool. This tool will check which words are common in spam and adapt the internal bayesian filters. After enough messages have been checked by the sa-learn tool, spamassassin will automatically start to use these filter rules.
SpamAssassin normally only labels messages, but doesn't move them. In my setup I use the procmail utility to check new messages for headers added by SpamAssassin. If these headers match certain criteria I move or delete them automatically. In my case all messages with a spam score of at least 5.0 are moved to a separate spam folder, and all messages with a score of 15.0 or higher are for the sharks.
hugh
12:15 pm on May 2, 2010 (gmt 0)
What syntax do you use in procmail.rc for move or delete? I've just been deleting all mail scoring more than 10.9 after a lot of rules tuning...
As you can see, I move the emails in both cases. If it is probably spam they go to the main directory /spambox/, if it is almost certainly spam to the sub folder /spambox/.Confirmed-spam/. This is because procmail is not able to delete email messages. You have to move them to a separate place and then delete them with another process.
Every night I run a cron job over the Confirmed-spam subfolder to feed all the messages there to the sa-learn tool. In that way I automatically keep my rules up to date. All spam messages in the /spambox/ folder which I have manually checked are also moved to the Confirmed-spam subfolder and are therefore also parsed by sa-learn each night.