Symphonious

Living in a state of accord.

Integrating SpamAssassin and Mail.app

This weekend I switched from DSpam back to SpamAssassin because of DSpams high false positive rate and my dislike of having to review all the spam it caught constantly. While doing so, it occurred to me that the way I’ve set up my anti-spam solutions is really pretty cool. I’ve essentially set up a partially self-training system with a user-friendly interface for providing feedback via Mail’s Junk mail button.

SpamAssassin is set up to run via procmail and dump any spam into the folder that Mail.app uses for its Junk mail. Mail.app is also set to move any spam it detects into that folder so there’s a two layer spam filter in place to move everything into that one folder for review.

The partial self training comes in by running sa-learn in a cron job to teach spam assassin that everything in that folder is spam. Any spam that SpamAssassin put there is ignored, but anything it missed and Mail.app detected is automatically used to train SpamAssassin. False positives are handled by manually fishing them out and running sa-learn –ham on my inbox to teach SpamAssassin that anything I’ve pulled out isn’t spam. Fortunately, Mail.app automatically moves messages back to the inbox when you click the “Not Junk” button.

The nicest part of it is that by having a two layer spam filter, I can switch one of them (in this case DSPAM to SpamAssassin) without being deluged by spam, because one of the filters is still well trained.

It’s all kind of neat really.