I configured postfix to forward mail to external addresses (mostly GMail):
user1@mydomain.com user1@gmail.com
user2@mydomain.com user2@gmail.com
office@mydomain.com user1@gmail.com, user2@gmail.com, ...
...
Everything works fine, except that when I send mail from my user1@gmail.com GMail account to user1@mydomain.com, it gets forwarded (250 OK in the log), but never shows up in GMail. That's probably not a common scenario, but sending mail from my GMail account to office@mydomain.com or putting myself in Cc is. I just don't like the idea of my message being lost without any sign of error.
I plan to configure a forwarding for a few other users too and I'm sure everyone will first test it by sending a mail to himself (and then tell me, that it doesn't work).
This issue has been discussed in a previous post:
- Can anyone confirm the reason for that behavior?
- Does anyone know how other mail providers handle it (I only tested it with GMail so far).
- Any suggestions for a workaround?
I know postfix can rewrite the header of a message. Could I just change the from-address in such a case (to something like forward@mydomain.com) to prevent GMail from ignoring the mail.
Best Answer
Top tip: just don't do this. It won't take long, then you'll have this situation:
I've been there and done that. In fairness, there's no way they can tell for sure that you're not the person actually originating the spam. There'll be a bunch of extra
Received
headers in the mail, but you could fake those.The other thing: SPF checks done by GMail will fail. Someone sends mail from (say)
serverfault.com
, you forward it to GMail, GMail checksserverfault.com
's SPF record to see if your mail server is allowed to send mail for that domain, finds out it's not and drops your mail on the floor.The correct way to do this is to keep the mail locally and have GMail pick it up via POP. GMail then knows that you're not the original sender, doesn't apply its spam checks in the same way and doesn't have the same problem with SPF.