Question

I've been having a lot of trouble trying to configure my server so I can send emails through PHP. I've read all the tutorials I can find but nothing seems very clear and it all assumes you have substantial background knowledge with this sort of thing.

The server is running CentOS with WHM/Cpanel and Apache. Everything is working fine on it except for the outgoing email. The mail() function returns true and there are no errors, but no email is sent either. The code worked fine on an older server and I've tried one line variants as well so I know it's not a problem with the code. I double checked that my SMTP server was running (Exim) using the WHM tools and restarted it for good measure with no success.

I am using Cloudflare as my DNS server and Google Apps for email. The Google Apps email works just fine. Could either of these things be affecting it? Is there something special I have to set up if I want to use Google Apps and send email directly from my server as well? Is there a DNS record I need to add? I honestly have no idea where to even start and nothing I've read has been the least bit helpful. I don't even know how to test my SMTP server to see if it's working or not.

If I didn't include any needed information, please ask me and I'll provide it.

[Edit] I've checked my spam folder and there's no new emails in there. Here's what shows up in the Exim logs when I try to send the email. I've edited the domains.

2013-05-13 19:20:34 cwd=/var/spool/exim 2 args: /usr/sbin/exim -q
2013-05-13 19:20:34 Start queue run: pid=9766
2013-05-13 19:20:34 End queue run: pid=9766
2013-05-13 19:43:13 cwd=/home/admin/public_html/portal 3 args: /usr/sbin/sendmail -t -i
2013-05-13 19:43:13 1Uc2Of-0002eC-Go <= admin@svr1.example.ca U=admin P=local S=533 T="New Event/Hazard Report" for jake@example.ca
2013-05-13 19:43:13 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1Uc2Of-0002eC-Go
2013-05-13 19:43:13 1Uc2Of-0002eC-Go SMTP connection outbound 1368488593 1Uc2Of-0002eC-Go example.ca jake@example.ca
2013-05-13 19:43:15 1Uc2Of-0002eC-Go => jake@example.ca R=lookuphost T=remote_smtp H=aspmx.l.google.com [74.125.142.26] X=TLSv1:RC4-SHA:128
2013-05-13 19:43:15 1Uc2Of-0002eC-Go Completed
Was it helpful?

Solution

I would recommend your check you SPF records. Most of the time we see this problem, either the SPF was not set or set incorrectly: support

Similar problem here:

Cannot deliver email to Google Apps address; Gmail receives the same email fine

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top