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. [email protected] 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:

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

This is really weird because both [email protected] and mail() seem to be working fine individually but when you mail() to [email protected] 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?

  • And what does the mail log within cpanel say? Also just because the website works doesn't necessary mean that DNS propagation is complete. Nov 29, 2014 at 6:12
  • @bybe, how do I find the mail log in cpanel? I'm sending the emails from PHP mail(). cPanel logs that?
    – datasn.io
    Nov 29, 2014 at 6:26
  • 1
    It depends on your level of access within your cpanel account, sometimes they disable it. You may need to ask to have a look at your /var/log/exim_mainlog and /var/log/maillog for your account. You should also try sending email with a SMTP Method and SPF record, often Google will block emails (not even put in spam) if the IP address on the server has been used for spam (normally shared hosting accounts). Nov 29, 2014 at 6:31
  • it seems like the problem is with the php mail(), can you post the settings you have there? Nov 29, 2014 at 10:18
  • 1
    It looks like new server is routing the email traffic internally. Which would appear to suggest the MX records (DNS) has not yet propagated? Where are the DNS master records, at your new host (I guess not?), or external?
    – MrWhite
    Nov 29, 2014 at 13:54

1 Answer 1


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 [email protected] 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:

  1. Wait until the propagation fully completes.
  2. 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 [email protected] and send messages through now.

  • 1
    A few days before changing the DNS it is advisable to modify the TTL (time-to-live) value for the respective DNS records to a low figure like 300 (seconds = 5 mins). So that when a change is made it propagates quickly (in theory anyway). Change the TTL figure back at the time of the move.
    – MrWhite
    Nov 30, 2014 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.