Not receiving email sent from PHP mail() after cPanel migration?

I just moved my site from one host to another by cPanel account backup and restore. Name servers are changed a few hours ago. is hosted at Google apps with MX records pointing to, etc.

Name servers change seems to have propagated because the website is working fine from the new server. However, there’s something weirdly wrong with emails:

  1. Emails sent from my Gmail (a native Gmail account) to are correctly received.
  2. I can then log in Google apps to view the inbox of, see the message and send a reply back to which is again correctly received.
  3. Emails sent to by PHP mail() from the new server are correctly received, with proper ‘mailed-by’ and ‘signed-by’ fields in Gmail.
  4. Emails sent to by PHP mail() from the new server are NOT received at all, NOT EVEN in spam.

This is really weird because both and mail() seem to be working fine individually but when you mail() to the message just doesn’t arrive.

Any idea why? Is it the DNS propagation or is there anything internally wrong with my server or code? Do I need just wait or do I need to do something?

If you are receiving all of the emails sent to your address but those going off-site are not being delivered then it might be that your new host requires emails to be sent using authenticated SMTP instead of the mail() function.

I had this problem when I switched hosting providers a few months ago and had to replace the mail() calls for my sites to send emails to external addresses.

Thanks for the help. Seems the DNS propagation has yet to be completed. That’s why mail() can’t resolve I waited some more time and it’s working now.

Lots of people are recommending SMTP over mail() ? Why?

Authenticated SMTP identifies the origin of the email so that it can be traced back to where it came from if necessary and also so that it can be returned if it is unable to be delivered.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.