1

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:

  1. Emails sent from my Gmail my-name@gmail.com (a native Gmail account) to info@example.com are correctly received.
  2. 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.
  3. 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.
  4. 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?

  • And what does the mail log within cpanel say? Also just because the website works doesn't necessary mean that DNS propagation is complete. – Simon Hayter Nov 29 '14 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 '14 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). – Simon Hayter Nov 29 '14 at 6:31
  • it seems like the problem is with the php mail(), can you post the settings you have there? – nunorbatista Nov 29 '14 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 '14 at 13:54
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 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:

  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 info@example.com 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 '14 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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