Cloudflare, reverse DNS and php mail ending up in spam folder

Joseph Szymborski asked:

I’ve been using Cloudflare to host my DNS, and PHPMailer to send e-mail through ZOHOs SMTP servers with great success, but have found that all my e-mails are hitting Gmail, Zoho and Hotmails spam folders.

When I disabled Cloudflare’s DNS hosting, and set-up my reverse DNS server, all my issues were resolved and mail wasn’t sent to the spam folder. Also, a host command changed from:

$ host has address has address mail is handled by 10 mail is handled by 20


$ host has address mail is handled by 20 mail is handled by 10

Now, while this is all well and good, I rather like the services Cloudflare offers, so I turned it back on after setting up my reverse DNS. When I test the e-mail again, it gets sent to spam, and if I turn Cloudflare off again, it’ll work again.

Am I forced to choose between using Cloudflare and having my mail sent to the spam folder? Please tell me there is a work around!

My answer:

When you have CloudFlare on, your reverse DNS doesn’t match your forward DNS:

$ host domain name pointer

This is one of the many things that get checked to determine if a message may be spam.

This is easy to fix: Just make them match, and use an actual hostname. For instance, set the PTR for to (at Ramnode) and set the A record for to (at CloudFlare).

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.