E-Mail Not Working In PHP / WordPress? It May Be CPanel MX Records…

// October 20th, 2009 // Web

I host a few domains through Nativespace and Host Gator (which both use the CPanel interface), and all of them have had one flaw – PHP apps like WordPress, Drupal, and also WordPress plugins like the Dagon Design Mailer Script have never been able to send email.  It’s quite hard to track down this kind of error yourself on a managed host with a web UI so in the past I’d not worried about it, but finally it came time to solve it (or rather get Ben to solve it, but I’ll write about it so others don’t have to go through the hard work)

The Problem: CPanel’s Broken MX Assumptions

Note: you can ignore this section if you don’t care why the problem occurs, and just want a fix!

It transpires that the problem occurs when the domain being hosted is registered through some other provider, which therefore runs the domain’s DNS and MX records.  MX records tell the world how your domain runs its e-mail.

Rather than do a proper MX lookup for sending e-mail, CPanel just assumes it runs the domain’s MX records and looks up in its own local configuration.  This would be fine if it did run the domain’s e-mail, but in these instances it doesn’t and therefore the e-mail ends up falling into a black hole.  Why the authors chose to do this is uncertain, but it is easy to fix.

The Fix: Redundanct Configuration

First, find the MX Entry icon in the Mail section of the CPanel front page:

CPanel's MX Entry icon

Click on it to see CPanel’s configuration for your domain.  The default looks something like this:

CPanel's default MX configuration

Many of my domains use the free Google Apps product to offer GMail accounts that work with the domain (ie. a GMail inbox tied to an @masochismtango.com address).  Here is the CPanel configuration you need if your domain does the same – if not, you’ll need to check your MX records with your domain registrar to find the right configuration to enter here.

Warning: this solution only works if you know the real MX records for the domain! If you don’t you could mess things up.  Remember it may be easier to just file a support ticket – I’m not taking responsibility if you mess this up!

First, add the correct MX configuration for the domain:

MX configuration for a domain with Google Apps GMail

For GMail, you can get away with just adding a couple of entries, at priority 1 and 5. Then, delete the old priority 0 entry which CPanel started with to leave just the real configuration:

MX configuration for a domain with Google Apps GMail

Now you’re done – hopefully your emails should instantly start working!

Share and Enjoy

  • Digg
  • TwitThis
  • LinkedIn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Ping.fm
  • Slashdot
  • email
  • Print
  • PDF

Leave a Reply