Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
I can't send email from my server to gmail addresses

I have a VPS server that I host some domains on for myself and clients. A client wants a catch-all on a domain that gets forwarded to an existing Gmail account.

"Simple", I say and go through a quick tutorial on it. For testing I forward @original-domain.com to oli@real-email-domain.com (of course these aren't real - but the proper values are correct).

Now to test it. First I wrote an email to oli@original-domain.com using Mutt on the server. Two seconds later an email plops into my oli@real-email-domain.com inbox (which is actually a Gmail for domains account).

But for a real test I sent an email from oli@real-email-domain.com to oli@original-domain.com, expecting to just email myself. Nothing came through. I can't find anything in spam or imagine any way that a filter could have caught it. I've looked everywhere for it.

I then decided to check on the server. In /var/log/mail.log there is a beautiful section:

Oct  3 12:59:40 nj postfix/qmgr[26568]: 9AFE448161: from=<oli@real-email-domain.com>, size=1063, nrcpt=1 (queue active)
Oct  3 12:59:41 nj postfix/smtp[26575]: 9AFE448161: to=<oli@real-email-domain.com>, orig_to=<oli@original-domain.com>, relay=ASPMX.L.GOOGLE.com[209.85.143.26]:25, delay=1.1, delays=0.29/0.01/0.
11/0.67, dsn=2.0.0, status=sent (250 2.0.0 OK 1317642647 et3si10294675wbb.52)
Oct  3 12:59:41 nj postfix/qmgr[26568]: 9AFE448161: removed
Oct  3 13:00:10 nj postfix/smtpd[26569]: disconnect from mail-yx0-f177.google.com[209.85.213.177]

That looks good. I've had a look at the part where Mutt sent its message, and it's like-for-like.

Because it's connecting, that suggests the firewall is okay (and I explicitly allow p25).

Is the email getting rejected by Google? Wouldn't it change the status of the send message (above) to something other than OK? What can I test next?

share|improve this question

marked as duplicate by mailq, Ward, Scott Pack, MDMarra, pauska Oct 5 '12 at 11:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

2 Answers

up vote 2 down vote accepted

It does look like it's being delivered to Google, is it appearing in the spam mailbox? As the recipient is the same as the sender Google may decide that it's a spoofed sender, and being a VPS IP will only add to the score. So try adding your mail server's IP to email whitelist (under "Settings > Email" in GApps admin panel).

Also ensure you have a SPF record setup for the domain which lists your servers IP.

As for the message status, in my experience Google always responds OK unless the recipient is invalid. Filtering probably happens later.

share|improve this answer
    
Looks like it was the SPF record. I had set it up before opening this thread but I guess GMail caches the DNS records of domains to stop it doing 100/second public queries. Seems to be working now. –  Oli Oct 3 '11 at 17:03
    
What was wrong with your SPF record? As it stands, this answer/comment won't help anyone else in the future who has the same problem. –  Ladadadada Oct 5 '12 at 10:16
add comment

I'll suggest just opening an account at something like hotmail to test from. Who knows what kind of strange behavior you'll run into with this kind of reflection - Google may have any number of reasons that it drops an inbound mail that appears to be from itself somewhere in the chain.

share|improve this answer
add comment

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