I’ve run my own mail server since, well, the UUCP days. I used to host a lot of mailiing lists so over the past 20+ years I’ve run Sendmail, Exim, Qmail and Postfix. They’re all different but they share one thing in common: unless running mail servers is your hobby, they’re not fire-and-forget applications, especially in the high-spam, high-malware, post-Snowden environment today. Maintaining a mail server is a chore. You walk a fine line between being buried in UCE and blackholing your Uncle Rich.
I stopped running mailing lists several years ago and since then I’ve wanted to outsource my mail servers to a reliable third party host. When I first experienced Google Apps I knew that’s where I wanted to be. I don’t understand what Google is doing but it’s the best mail handler I’ve used. I rarely get spam in my Gmail but I’ve never had a false negative that I’m aware of. On Gmail, you don’t have to muck with Baysian filter settings or install RBLs. It just works.
The problem is that I create a different email address for every web site I use so I have well over 700 aliases and Google Apps only supports 30 per user with no options to increase that number. One alternative is to use Google Groups for aliases but that presents its own set of problems. Then a friend of mine, Jesse, told me about yet another alternative.
What Jesse does is keep the MX for his domain and runs his own mail server. But all his local server does is act like an alias forwarding agent. When mail arrives for firstname.lastname@example.org it consults its alias database and forwards the mail on to his Google Apps account and one of the restricted number of Google aliases. Google doesn’t have MX for his domain but it’s set up to send mail as XX@jessedomain.com.
This is exactly what I wanted for myself and in fact tried a couple of times to get it to work. It failed because I handed my primary MX to Google Apps. The first part of the trick is not to do that. Keep your MX or use Google only as a fallback MX.
When you create an account on Google Apps it gives you a temporary email address to use for testing: USER@DOMAIN.test-google-a.com. That’s your pipeline for forwarding your local aliases. Simply add this target address to the /etc/aliases (or whatever it’s called) on your local mail server:
Then set up your email client to use Google Apps for inbound IMAPS email (imap.googlemail.com on port 993) and smtp.googlemail.com (on port 587 with TLS) for outbound email.