« Renaming the comment script | Main

Spam filtering with Gmail

Pair's default spam filtering options are pathetic. SpamAssassin is wholly inadequate, and after 2 months of trying, I still couldn't get Bayes to work. So I finally gave up, disabled spam filtering, and am now using a Gmail account as the spam filter for all of my Pair aliases. I configured the Gmail account to forward messages to gmail@huangfamily.com. The idea is basically:

Ham → @huangfamily.com → huangfamily.com@gmail.com → gmail@huangfamily.com → Deliver

Spam → @huangfamily.com → huangfamily.com@gmail.com → Gmail Spam folder

At the top of my .procmailrc file (which handles all mail sent to @huangfamily.com), I added the following rule:

The rule basically says, send all new messages to Gmail, and if they return, deliver them. Since Gmail doesn't forward spam, only clean messages will return. To prevent loops, the rule checks for the X-Forwarded-For header set by Gmail when it forwards messages. Messages sent directly to gmail@huangfamily.com are dropped.

I suppose that a smart spam bot could fake the X-Forwarded-For header. They can't fake Received headers, though, so if this starts happening, I could replace the condition with one that checks that the message was sent from a google.com relay.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)