Troubleshooting wp_mail WordPress Email Configuration

This is a continuation of the thoughts presented in the article “Testing the wp_mail Function.”  That article focused on how to actually check your WordPress email configuration with direct test of the wp_mail function to be sure that the function itself is working.  This is a good place to start if you are troubleshooting because if the function itself is not working, you need to track that down first.

If you have determined that wp_mail is operable, it is then probable that emails are being generated.  Knowing this, the next step is to consider other elements of your WordPress email configuration to track down why emails are not being sent or received.

Understanding script based email

WordPress sends email using wp_mail, a function that for all practical purposes operates like php’s mail. It is a way for your site to send email via a PHP script.

In order to determine what your problems might be, it is important to understand the potential email configuration requirements. Some issues could be server-based, others could be not understanding restrictions by your host.

What are your host’s email policies?

Valid email accounts

The first thing to know is what your host’s policies are for sending email via web scripts. If you spend a lot of time trying to track down problems before even knowing if you are in compliance with your host’s email policies, you could be wasting a lot of time.

Valid email headers

Some hosts require that any server-side email script send with a “from” address that is an actual email address. This may seem basic, but I’ve had a lot of support inquiries that didn’t bother to check this. WordPress by default sends email from a generic address “[email protected]”. If your host has a requirement that you send from a valid email address and you don’t have a [email protected] email configured, then your site can’t send email.

This isn’t a requirement with all hosts, but you should check to see if it is a requirement of yours. If this is a requirement, there are some things you can do to change the default “from” address.  See the following:

Another commonly overlooked issue that is similar is that some hosts require you send with a valid “from” header. Again, the WordPress default configuration doesn’t cover this – it sends email without headers.

There are other headers that can help prevent your message from being rejected as spam.  Making sure that the return-path header is not only a valid address, but matches the “from” address will take you a long way in this regard.  And you can take care of this either by sending through an SMTP server or just filtering the phpmailer to make this match your “from” address.

Are you on a shared server?

In general, on shared hosting, the email process is shared, too. If another user on your host has a script that is tying up the email server, that is going to effect your site (and therefore your email script).

For those running WordPress on shared hosts, the issue most often is that email is delayed (sometimes significantly), not that it is inoperable.  But it is important to know if this is something you are likely to be effected by.  Just because someone doesn’t receive a message within seconds does not by itself mean that the message is not being sent.  It could be delayed.

What about spam filters?

Sometimes, the issue is that certain messages are simply blocked because of an addressing issue.  Emails coming into one of the major email provider domains (hotmail, aol, gmail, yahoo) can get flagged for a number of reasons.

If email from wp_mail is not getting delivered, you may need to consider is it not getting through to everyone?  Or is this limited to certain domains?  Getting blocked or blacklisted by a specific host could be an issue.

An easy solution

The simplest way around all of this is to use a valid email account sent through an SMTP server.  SMTP stands for Simple Mail Transfer Protocol and sending through an SMTP server simply means you have set up a real email address on your system and you are allowing the web based script (wp_mail) to connect to the server with appropriate account credentials.  This will satisfy most hosting requirements and also help you avoid system bottlenecks on shared hosting.

My usual solution for this is a plugin called WP Mail SMTP.  The problem with this is that the plugin has not been updated in over 2 years.  That could mean issues with more recent versions of WordPress (although at present that shouldn’t be the case) and also means you are likely on your own for support.

There are a few other plugins out there for this purpose as well.  Although not as popular (yet) as WP Mail SMTP, Easy WP SMTP looks promising.  Another is WP SMTP.  Using one of these plugins is an easy way to change your WordPress email configuration to send email via SMTP.

Of course, if you’d like to do it without a plugin, you can do that without too much trouble as well.

No matter which way you choose to approach it, SMTP is a more reliable and more stable way of sending email through WordPress.

For more information on testing, troubleshooting, and changing your WordPress email configuration for wp_mail, here are some additional posts:

WordPress Membership Plugin WP-Members 2.8.6 Release Announcement

An update for the WordPress membership plugin WP-Members was released tonight.  This is the 2.8.6 release and it is a minor code update along with some minor changes to the stylesheets for the forms.

For a full description of update (and of course, more information on the plugin in general), see the release announcement at the plugin’s support site. Rebuild on Genesis 2.0 Framework

With the launch of Genesis 2.0, I have been getting my hands dirty with the Genesis Framework.  I’ve always liked the framework, and I’ve owned it for quite some time; but I never really got in there and made full use of it.

After giving a makeover with Genesis 2.0, I moved on to where all of the support goes on for WP-Members. had launched in 2012 for supporting WP-Members and was built around Twitter Bootstrap.  At the time, I liked what I could do with Bootstrap, and since part of the site’s function is to show how flexible the WP-Members framework is, that gave me the opportunity to do some pretty cool things with the plugin framework.  To make these reproduceable for users of the plugin, these were all written up as example code on the site in the “How I Did It” category.

But there is always room for improvement.  With Genesis 2.0, I decided to get in there are give that site a makeover.  It is not fully complete, but the Phase 1 build is launched.  Go over to and take a look.  The site is running on Genesis 2.0 and WP-Members.

Here are some of the cool custom features that I did (and I’ll be adding these as new tutorials in the “How I Did It” category):

  • Unique login page makes use of the Genesis full width template so we don’t show two login forms (body and sidebar widget).  Also, this page uniquely styles the login form and adds some text for non-members inviting them to learn more about joining.
  • Now running the WP-Members with the Genesis Stylesheet Pack Add-on.  There will be additional stylesheet add-ons in the future, but I am still trying to get through plug-and-play stylesheets for the plugin to integrate with the various StudioPress child themes.  And as Brian Gardner continues to roll out new versions of the various child themes for the 2.0 Framework, that will likely keep things pretty busy over here.
  • Site continues to run with the WP-Members PayPal Subscription Add-on, which will be getting a major update after we roll out and test it on the site.
  • More to come!

There is still a lot to do for Phase 2, but I am excited about the project.  For those of you that liked the Bootstrap Tabs that I had done as an example on the old site, I’ll be doing another tabbed customization of the login/registration form combination as part of Phase 2.  The Bootstrap version was pretty tricky to implement.  I hope that this new one turns out to be an easier customization for general users to implement.