Filtering Non-Gmail Email With Gmail
By Daniel Miessler on April 5th, 2006: Tagged as Google | Spam
A couple of days ago I had a cool idea: since Google seems to be so good at filtering spam for their Gmail offering, why not make use of that functionality for my own personal mail?
The way I see it, spammers have full access to Spamassassin, which makes it almost trivial for a dedicated person to be able to bypass it. Furthermore, since major rule releases come out so infrequently, their work bypassing it has a good lifespan on it.
The Google Difference
The difference with Gmail spam filtering (vs. Spamassassin) is that there is likely a team of engineers working on nothing but spam filtering for Google. They probably use a number of free products stacked in layers, in addition to some highly proprietary code. And best of all, this defense is likely to be quite a bit more nimble than the Spamassassin project — meaning that they can see something innovative that’s getting through the filters and make a change immediately to counter.
So Gmail spam filtering clearly has its advantages. I decided to leverage that against the constant flow of trash that makes it through Spamassassin, starting yesterday. The cool thing about this is that I’m not just “using” Gmail as a spam filtering service. I also use it as the web interface for my main account. Here’s how I set it all up:
—
This technique is for people who have their own mail servers and/or have a way to change their settings at the admin level. My personal solution is based on Debian, Postfix, and Courier-IMAP.
Gmail Forwarding
The solution hinges on the ability to forward mail from a Gmail account to another address. All of us can do this; it’s under the POP and Forwarding section of your Gmail settings.
- Create an alias on your mailserver for your primary email address.
So for me, this would be for the daniel account. Point that alias to a Gmail address that you are going to capture spam with. This is also the account that you are going to use for webmail. Don’t forget to run
newaliasesto get the alias to take effect. - Create a new user account on your mailserver. Name it something like spam_account, or whatever. This is where your Gmail is going to send all of your (now filtered) mail.
- Copy your Maildir folder (or whatever format you use) from your main account to the newly created account. This is the actual account your IMAP and/or POP client is going to be pulling mail out of from this point on. Delete the old mail folder if you are into being neat.
- Go into your Gmail account and forward all mail to your newly created email address So if you used the previous example, you’d be forwarding all email to spam_account @yourdomain.com.
There, now the linking is complete. The way this will break down is like so: mail will come into your main address (you@yourdomain), get aliased to $you@gmail.com, get filtered by Gmail, get forwarded (clean) to your alternate account on your mailserver, and then get picked up via your IMAP or POP client.
Remember, you are not logging into your main account anymore with your mail clients; you’re logging into the alternate “mail/spam” account.
Conclusion
So that’s pretty much it. You now have a fully functioning mail system that benefits from Google’s uber spam filtering prowess. If you’re feeling froggy, however, you should then run all the mail that hits that alternate account through your own Spamassassin implementation. That’s what I do, and it does occassionally catch a few wiley characters that make it through Gmail’s filtering.
If you have any comments or questions, feel free to comment below or contact me directly.:
Pingback: gmail account