Properly forwarding email to Gmail
So I have a custom email address, email@example.com, which I want to forward to firstname.lastname@example.org.
Since I use NameCheap as my registrar, I had the option of setting up email forwarding via their UI. Very easy, but with drawbacks: sometimes email just wouldn’t arrive and I had no way of figuring out what the problem was.
Then, while moving my hosting to DigitalOcean, I decided to do the forwarding on my own server. So I configured the MX records and added virtual aliases in Postfix and pretty soon got a strange error from Google’s SMTP servers:
Our system has detected an unusual rate of 421-4.7.0 unsolicited mail originating from your IP address. To protect our 421-4.7.0 users from spam, mail sent from your IP address has been temporarily 421-4.7.0 rate limited. Please visit 421-4.7.0 http://www.google.com/mail/help/bulk_mail.html to review our Bulk 421 4.7.0 Email Senders Guidelines. f14si1032016icj.42 - gsmtp (in reply to end of DATA command))
After a bit of Googling, it seems somebody had the same problem and one suggested fix went like this: instead of pushing email to Gmail, make Gmail fetch it via POP3, so that’s what I did:
- Enabled POP3 access by installing Courier.
- Created a separate
postmasteruser (which doesn’t have
- Routed all incoming mail to the
- Added the credentials in Gmail (Settings → Accounts and Import).
and it seems to work great. Gmail fetches mail from my server at its own pace, while leaving malicious email in place. I should probably set up a cron job to delete messages left in
Basically, everything you need to know is in this excellent tutorial on the Ubuntu Wiki.
For a long time, for me Postfix was that thing that never works right, but after reading a few clear tutorials, it actually sort of makes sense. So, drop me a line anytime. :)comments powered by Disqus