Messages sent by Exim to Gmail never arrive.

My PHP app is now sending mail via Exim just fine to everywhere but Gmail.

Weirdly, if I send to Gmail via the command line, like
> echo "This is test 1." | mail -s Testing_1 redacted@gmail.com
the message arrives promptly in the inbox.

BUT

When my PHP app sends a message to Gmail, their servers appear (based on the Exim logfile) to accept the message without error, but the message never arrives in the inbox (or spam folder). I have tried several different Gmail addresses with the same result.

Here's an example of a happy-looking logfile message:

2014-01-09 11:52:54 1W1JmV-0000Eh-Cw => redacted@gmail.com R=dnslookup T=remotesmtp H=gmail-smtp-in.l.google.com [2607:f8b0:400d:c02::1a] X=TLS1.2:RSAARCFOUR_SHA1:128 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"

But if I log into Gmail as redacted@gmail.com, there is no message in the inbox or in spam.

Best I can tell, I have a valid SPF record that authorizes linode to send mail for my domain. Not sure what other sins I could be committing.

Any ideas?

10 Replies

Emails a tricky thing, even a single link can block a message getting through spam filters. (I had this problem with yahoo a couple of weeks ago).

What's your server's FQDN hostname -f and the email address you're sending from?

hostname -f returns http://www.acceleratenorthfield.org

The sender is baz@acceleratenorthfield.org

In the process of answering that question, I checked the full message headers on one of the other, non-gmail recipients of one of the failed messages, and here is what I found:

> Received-SPF: fail (google.com: domain of www-data@acceleratenorthfield.org

does not designate 2600:3c00::f03c:91ff:fedb:7934 as permitted sender)

client-ip=2600:3c00::f03c:91ff:fedb:7934;

Authentication-Results: mx.google.com; spf=hardfail (google.com: domain of

www-data@acceleratenorthfield.org does not designate

2600:3c00::f03c:91ff:fedb:7934 as permitted sender)

I changed my SPF record from
> v=spf1 a mx ptr a:mail.acceleratenorthfield.org a:www.acceleratenorthfield.org a:acceleratenorthfield.org ip4:198.58.126.51 mx:mail.acceleratenorthfield.org -all

to
> v=spf1 a mx ptr a:mail.acceleratenorthfield.org a:www.acceleratenorthfield.org a:acceleratenorthfield.org ip4:198.58.126.51 ipv6:2600:3c00::f03c:91ff:fedb:7934/64 -all mx:mail.acceleratenorthfield.org -all

Now I no longer get the SPF fails in the message headers, but my messages still don't show up in my Gmail inboxes.

[CORRECTION: I'm still getting the old fails, so the SPF record must not have propagated yet. I'll try again in a couple of hours.]

You can't have http:// in your FQDN hostname. It should be whatever your computer name is + the domain name (i.e. sparky.acceleratenorthfield.org)

Yes, sorry, that was a typo. hostname -f returns www.acceleratenorthfield.org

Headers from Gmail (these headers appear on messages for one of the CC recipients whose address is not at Gmail) now confirm the SPF record is correct and complete:

> Received-SPF: pass (google.com: domain of www-data@acceleratenorthfield.org

designates 2600:3c00::f03c:91ff:fedb:7934 as permitted sender)

client-ip=2600:3c00::f03c:91ff:fedb:7934;

Authentication-Results: mx.google.com; spf=pass (google.com: domain of

www-data@acceleratenorthfield.org designates 2600:3c00::f03c:91ff:fedb:7934

as permitted sender) smtp.mail=www-data@acceleratenorthfield.org

but message still doesn't appear in Gmail inbox or spam folder.

does hostname return "www" ?

hostname -f should return the hostname+domain

You shouldn't name your server "www"

hostname returns northfield

hostname -f returns http://www.acceleratenorthfield.org

/etc/hosts looks like this:
> 127.0.0.1 localhost

127.0.0.1 debian

198.58.126.51 http://www.acceleratenorthfield.org northfield

The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

I'm guessing that's b0rked? Can you talk me through fixing it?

Here's a CentOS box I'm just getting started setting up the LAMP stack and Web Engine (sorry, it's on a DO droplet, it was the only free dev space I had, and this is a open source gratis project so money is more scarce then the need for Linodes most excellent network and support).

nano /etc/hosts

127.0.0.1 localhost localhost.localdomain

192.241.224.196 midori.ipcopsupport.org midori

nano /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=midori.ipcopsupport.org

hostname

returns midori

hostname -f

returns midori.ipcopsupport.org

Okay, thanks.

I changed /etc/hosts to
> 127.0.0.1 localhost localhost.localdomain

198.58.126.51 northfield.acceleratenorthfield.org northfield

The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters
and rebooted.

hostname responds northfield

hostname -f responds northfield.acceleratenorthfield.org

My web apps are all still running fine.

I re-tested my email issue, and found no change:

When I have PHP send a single message with multiple recipients, the non-Gmail accounts receive the message, and the Gmail accounts do not. No errors in the Apache logs.

Anyone have ideas what to try next?

You've changed your hostname to northfield.acceleratenorthfield.org however your rDNS is pointing to www.acceleratenorthfield.org you should update this, you should also change -all to ~all in your SPF records -all tends to be a bit aggressive. Update your records give it 24 hours and try again.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct