I'm trying to host my own email forwarding for my domain on a small VPS but am having some odd problems getting forwarding to work. I am using exim4 on Ubuntu 12.04.1 LTS and all of my packages are up to date. My setup is such that any email that comes in to a local user (user@mydomain.com) gets forwarded to user@gmail.com. I also have SMTP setup so that I can send through my own server from Gmail. The forwarding is set up through my /etc/aliases where I simply have

user:        user@gmail.com

I am able to send from my VPS to user@mydomain.com (using mail -s "subject" user@mydomain.com) and I receive the mail in my Gmail inbox. I am able to send from my VPS to user@gmail.com (using mail -s "subject" user@gmail.com) and I receive the mail in my Gmail inbox.

When I try to send from Gmail (or any other address) to user@mydomain.com I can see the message arrive in the logs and exim attempts to send it out, but the email does not show up in the local mailbox (check with the mail command) and it does not get forwarded to Gmail. The exim logs show this:

2013-02-12 19:27:56 1U5QCZ-0002bt-VA DKIM: d=gmail.com s=20120113 c=relaxed/relaxed a=rsa-sha256 [verification succeeded]
2013-02-12 19:27:56 1U5QCZ-0002bt-VA <= user@gmail.comH=mail-qe0-f53.google.com [] P=esmtps X=TLS1.0:RSA_ARCFOUR_SHA1:16 S=1736 id=CABfo9zkf+wF3TcniU4VjcCTLDnR2NtY2JsFa2YQrMJqmWYKnHw@mail.gmail.com
2013-02-12 19:29:02 1U5QCZ-0002bt-VA gmail-smtp-in.l.google.com [2607:f8b0:4001:c02::1b] Connection timed out
2013-02-12 19:29:05 1U5QCZ-0002bt-VA => user@gmail.com <user@mydomain.com> R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [] X=TLS1.0:RSA_ARCFOUR_SHA1:16 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"
2013-02-12 19:29:05 1U5QCZ-0002bt-VA Completed

Even the Send Mail As verification email to user@mydomain.com gets forwarded to my Gmail account!

I've checked exim -bp to see if there is anything in the queue but it seems to be empty. I've also done a traceroute on the specified gmail domain and it seems to complete fine. I've seen similar issues posted before, however, all the ones I've read have been all or nothing cases where nothing gets forwarded through, not selectively like this.

Does anyone have any suggestions or recommendations on how I could fix / further debug this problem? Thanks!

  • Have you checked your spam filter? It's quite possible that google might be filtering the emails. Lastly do you have SPF records for your domain? – Danie Feb 13 '13 at 5:43
  • I have checked my spam folder and it seems to be clear, so I don't think that is a a problem. I will try getting an SPF record for my domain and see if that fixes the problem. – nhmood Feb 13 '13 at 15:06

It turns out that this is actually an issue (feature?) on Google's end. If you send email from an address that automatically forwards back to you (eg. user@mydomain.com -> user@gmail.com) it will NOT appear in your inbox and only appear in your Sent Mail folder.

This is apparently to prevent multiples of the same message appearing in your inbox (ie. if you are subscribed to a mailing list and send mail to it, you don't want to have your own response in your inbox). They seem to have made this the default on any emails that automatically forward back to keep things consistent.

Reference: http://productforums.google.com/d/msg/gmail/npFUvcOUVPo/4ViZhQNdxfIJ

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.