No frikin tables...
Friday 30th 2010f July 2010 01:25:26 PM

SpamAssassin Trainer

This scripted was created to teach SpamAssassin using sa-learn about spam and ham (non-spam). The script is fairly dynamic, it requires 3 folders that are .Spam, Spam.Spam, Spam.Ham. The Spam.Spam and Spam.Ham folders are there if the spam filter makes a mistake, the user should manually move the email to the correct folder, so that sa-learn can learn to correct the mistake. The ham then gets redirected to procmail, once it has re-learnt the email, so procmail can filter it to the correct folder instead of the spam folder. The spam, if detected, gets moved straight to the .Spam folder. The script is dynamic in a way that it will learn ALL folders that are inside ~/.maildir and has . (dot) in front of the name as a ham folder.

Warning, this includes the .Trash folder. So make sure you always put spam email to either the .Spam folder or .Spam.Spam folder. The emails inside .Spam.Spam folder will be re-learnt, so that this mistake does not happen again.

Make sure you save this somewhere like /usr/bin/spamassassintrainer, and then:
chmod +x /usr/bin/spamassassintrainer

So that you can excecute the file. The best way use this script is using cron. Set cron up so that it runs this script every 2 hours, or something:
0 */2 * * * /usr/bin/spamassassintrainer >/dev/null 2>&1

There's no point in running it too many times. The spams not going anywhere ;-)
spamassassintrainer.py View Download