Mobile app version of vmapp.org
Login or Join
Sherry384

: Not receiving email sent from PHP mail() after cPanel migration? I just moved my site example.com from one host to another by cPanel account backup and restore. Name servers are changed a few

@Sherry384

Posted in: #Cpanel #Dns #Email #Php

I just moved my site example.com from one host to another by cPanel account backup and restore. Name servers are changed a few hours ago. info@example.com is hosted at Google apps with MX records pointing to aspmx.l.google.com, 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:


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


This is really weird because both info@example.com and mail() seem to be working fine individually but when you mail() to info@example.com 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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sherry384

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gloria169

After the name servers change and migration, while my website is correctly working from the new server, it doesn't mean the propagation of the change has completed.

When my new server tries to send an email to info@example.com via PHP mail(), it has to look up the MX records of example.com for the destination server. However as the propagation hasn't completed yet, it is not able to acquire the IP of the destination server for the time being, thus failing to send the message through.

Therefore we have 2 solutions:


Wait until the propagation fully completes.
Change the DNS servers the sending server looks up to resolve email domains, in this case, example.com.


I switched to Google DNS for my server so mail() can successfully resolve info@example.com and send messages through now.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme