Ubuntu – Can’t send email to theself via gmail and postfix forwarding

gmailpostfixspfUbuntu

I set up postfix to forward email to my gmail account. I can send email from this server to my gmail, I can receive outside email and it's forwarded correctly (even from other gmail accounts). However, I can't send email from my gmail to this machine.

I get no error messages in postfix's log, it all looks fine. The email isn't marked as spam, it just never reaches my gmail inbox.

Here's postfix:

postfix/cleanup[4435]: B5BE7E0A06: message-id=<CABHVO+zD_LCYXWWiABRvXxb=rjez4uBXGo2N9__zkOWo1KVwOA@mail.gmail.com>
postfix/qmgr[4183]: B5BE7E0A06: from=<stefano.palazzo@gmail.com>, size=1416, nrcpt=1 (queue active)
postfix/smtpd[4431]: disconnect from mail-wm0-f46.google.com[74.125.82.46]
postfix/smtp[4436]: B5BE7E0A06: to=<stefano.palazzo@gmail.com>, orig_to=<hello@xn--y-5ga.com>, relay=gmail-smtp-in.l.google.com[64.233.166.26]:25, delay=0.13, delays=0.06/0/0.03/0.04, dsn=2.0.0, status=sent (250 2.0.0 OK 1449920800 r66si5494735wmd.91 - gsmtp)
postfix/qmgr[4183]: B5BE7E0A06: removed

Also my postfix config.

The SSL certificate is valid for the domain. The spf record of the domain looks like this:

TXT "v=spf1 ip4:212.47.242.239 ~all"

What's going on? What am I missing?

Best Answer

Gmail is dropping the mails siltently. This seems to ba a policy by Gmail. Read this: I’m having trouble sending messages in Gmail

If a message you've sent never arrived at its destination, you should first check your Sent Mail. Messages that you send to a mailing list, or to an email address that's automatically forwarding your mail to Gmail, will only appear in your Sent Mail.

Why is gmail doing this? This seems to be the answer: Best practices for forwarding mail to Gmail

Authentication

  • Do not modify, remove or shuffle message headers or modify the body of the message. DKIM or DomainKeys signatures will break if the body is altered, and all authentication information will be lost.
  • Common DKIM breakages include modifying the mime boundaries, anti-virus or anti-spam programs modifying the body of the message, expanding the message recipient using LDAP, and re-encoding the message.
  • Several highly-phished domains have asked Gmail to enforce strict authentication checks on their mail. These domains include eBay, Paypal, and Google. If your mail server modifies the forwarded messages from these domains, these messages will be marked as phishing.
  • One symptom of this problem is that a messages from these domains forwarded through your mail server to Gmail will have an Authentication-Results header that show that DKIM did not pass, while messages sent directly to Gmail will have a passing signature.