Running your own server-side spam filter with SpamSieve | Dafacto
Dafacto

The personal website of Matt Henderson.

Running your own server-side spam filter with SpamSieve

11 August 2012

This article describes how I use the SpamSieve product for Mac OS X to provide server-side spam filtering.

For years, I hosted my email on a dedicated server leased by our company. On the client side (a Mac, in my case) I used SpamSieve—a commercial product that’s more effective than Apple’s included spam filter—to keep my inbox free of spam.

The problem

Things got tricky, though, when I switched from POP to IMAP, in order to access my email on both a laptop and a desktop computer, particularly because of the self-training nature of spam filters like SpamSieve. See, although you might teach the spam filter on your laptop that a particular message is spam, the same filter on your desktop will have also seen the message and, though self-training, taught itself that it’s good!

Things got further complicated when I got an iPhone and iPad, and began using Mail in mobile environment that didn’t even offer client-side spam filtering. I’d go on a travel, check my email at the airport, and have to slog through hundreds of spam messages (paying 3G data rates to boot!)

Due to the amount of spam I receive, I finally switched to online email providers like iCloud and Gmail, given their server-side spam filtering capabilities.

But I wasn’t happy about having to do that; I much prefer having control of my own email. And by now, we’ve all heard about the risks of entrusting your email to others. Indeed, it was those risks that led me to switch back to self-hosted email, even with the burden of having to deal with spam myself.

The solution

That burden, though, was elegantly resolved this morning, as I revisited my old friend SpamSieve, and discovered a newly supported feature which provides the same single-point spam management I had with Gmail or iCloud.

Here’s how it works:

  1. Setup Mail.app on a Mac that's permanently connected to the internet. That could be a home iMac, or something like an internet-hosted Mac mini.
  2. Install and setup SpamSieve on that machine as normal, with one exception — rather than creating its "Spam" folder on the local machine, create it on the IMAP server. (Note that installing SpamSieve basically involves installing the app, letting the app install the Mail plugin, and finally creating a single Mail rule that passes all incoming mail to SpamSieve.)
  3. Create two additional IMAP folders, "TrainGood" and "TrainSpam", for a total of three spam-related folders on your IMAP server:
  4. Download an AppleScript from C-Command, install it in ~/Library/Application Scripts/com.apple.com and create a second Mail rule to additionally process all incoming mail through that AppleScript. (Important: As somebody incapable of reading instructions, I overlooked the fact that you need to manually edit this AppleScript, specifying the name of your email account. That oversight cost me some time and confusion. So learn from my mistakes, and RTFM!)
  5. Finally, disable spam filtering on all your other computers and devices, as that single machine is all that's needed.

So how does this work?

My home iMac is continually checking my email. SpamSieve on that machine is continually processing the email, moving any messages it thinks are spam to the “Spam” folder — keeping my inbox pretty much spam-free for my MacBook Air, iPhone and iPad.

But what happens when SpamSieve makes a mistake?

Remote training

If I’m checking mail on my iPhone, and see a spam message that SpamSieve missed, I simply move the message to the “TrainSpam” IMAP folder — that’s two taps on the iPhone. The next time the home iMac checks email, SpamSieve will see that message in the “TrainSpam” folder, and self-train itself to recognize those type messages in the future.

Same thing with the rare good message that SpamSieve thinks is spam. If I review the Spam folder on my MacBook Air, and see a good messages, I just move it to the “TrainGood” IMAP folder, and SpamSieve at home will eventually see it and train itself accordingly.

I’m really happy with this setup, and excited about the discovery that I can again manage my own email, and enjoy the server-side filtering benefits I had with services like iCloud and Gmail. And what’s obviously cool, is that I can train the spam filter from any device!

Final notes:

  • Just to be clear, I'm not talking about hosting my email at home; rather, this is about managing my spam at home. My IMAP email server is still hosted on a dedicated server, and all the devices, including the Air, iOS devices, and home iMac, access that server.
  • I've also tried third-party spam solutions like Postini, and didn't like any of them. Since those services quarantine your spam, those same messages aren't locally searchable. And you have to remember to periodically visit the website, or review daily quarantine emails. Releasing false-positives is a pain, etc.
  • SpamSieve is the second product from Michael Tsai at C-Command that I heavily depend on. The other is EagleFiler, for archiving my important documents and keeping a backup archive of my email. I hope to write about it before too long. Just one look at the quality of the documentation will give you an insight into the quality of Michael's products. I've been using them for more than a decade!

Enjoy this article? — You can find similar content via the category and tag links below.

Questions or comments? — Feel free to email me using the contact form below, or reach out on Twitter.