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.

7 Responses to “Integrating SpamAssassin and Mail.app”

  1. Steve Says:

    Would it be possible for you to post instructions? I would like to see how you did it and possible implement it myself!


  2. jwp Says:

    Yes please! :) I’ve recently started playing with SpamAssassin and Mail due to the overwhelming amount of new spam that seems to get through now. Instructions on how to set this up would be appreiciated. Thanks.


  3. Adrian Sutton Says:

    I’ll see if I can put together something coherent in the next few days.


  4. Steve Says:

    Thanks very much Adrian!


  5. Flo Says:

    hi,
    i compiled a little guide on how i do this on my server.
    i hope my explanation makes any sense: http://blog.no-panic.at/2006/11/15/training-spamassassin-from-within-apple-mail/

    (note: i used the trackback with my post, but eventually it doesn’t show up here. if there’s just a slight time delay, disregard this comment!)


  6. Adrian Sutton Says:

    Thanks for that Flo, that looks pretty much like how I’ve got mine set up.


  7. Symphonious » Getting On Top Of Spam Says:

    [...] I spent some time this afternoon trying to reduce the amount of spam that gets downloaded and dumped into my spam folder. Between SpamAssassin and Mail.app's spam filters there's basically no spam that makes it through to my inbox, but the sheer amount of spam being sent to symphonious.net, then downloaded from their to my home IMAP server before finally being processed by SpamAssassin is overwhelming and takes up a lot of bandwidth and processing time. Besides, with that much spam going into my spam folder I haven't been bothered reviewing it so if there are any false positives they are pretty much doomed. [...]


Leave a Reply

(Valid OpenIDs will skip moderation)

Alternatively, subscribe to the Atom feed.