You’ve set up your WordPress site, there’s just one issue.

Your website can’t send mail.

This means your contact forms don’t work, new user emails don’t work, password reset requests can’t be sent. It’s not a good situation. The good news is, there’s a pretty simple fix.

How to Fix WordPress Mail

Signs the WordPress Email Function is Broken

These are some common error messages when the standard WordPress mail isn’t working:

  • WordPress Password Reset: “The e-mail could not be sent. Possible reason: your host may have disabled the mail() function.”
  • Contact Form 7: “Failed to send your message. Please try later or contact the administrator by another method.”
  • You fill out a contact form and never get an email message.

If you aren’t seeing any error messages from the site, then your site may be sending emails, you just aren’t receiving them. Don’t worry, the solution below works for everything!

How to Fix Your WordPress Mail So You Can Send Emails Again

First, you need to login to WordPress. If you only have one account and can’t remember the password, then the only way to get in is to reset your password directly in the database. You should contact your developer or hosting provider to have them reset it. If neither of these is an option, click here for instructions for changing this yourself, but use at your own risk.

Now that you are logged in, we are not only going to fix your WordPress site’s email but also make sure that all emails your website tries to send are tracked so you don’t miss anything!

Set up Mailgun

You want to make sure that your website is not only sending email but that the emails are being delivered. In order to do that, you need a transactional email with tracking.

What’s transactional email? It’s an email that is automatically as a result of a user action. So if you click on “reset password”, that’s an action and an email is sent as a result of that action. Same is true if someone fills out a contact form (action) and then an email is automatically sent (result).

Mailgun is a transactional email service that gives you the basic features for free.

So head over to the Mailgun website and sign up for an account. Watch the video below to see how easy setup is!

Remember, while Mailgun is free for basic users, you need to set up a credit card with them. The reason is that they use the credit card to verify you are a real person (you aren’t charged).

Once you’ve created an account, you may be asked for business verification. If you are only sending a small number of emails and only from one domain, you will probably never see this.

However, if you have several domains or start sending many emails, you will probably be required to do a short business verification.

If you are requested to do business verification, here’s what you need to tell them:

  • You are sending transactional emails for people who fill out forms on your contact page requesting you to contact them (or whatever your situation — perhaps it’s for people placing an order on your site and getting a receipt)
  • You get people’s email addresses when they enter their contact information on your contact form (or place an order or whatever other forms they fill out)
  • Your contact page is: (insert your URL)
  • Your privacy policy: (insert your URL — if you don’t have a privacy policy, go read about why you need a privacy policy)
  • Low monthly volume (put here a guess at how many emails you expect your website to send — if it’s under 100, then just put “under 100”)

Mailgun’s tech support will usually clear your domain generally in a couple of hours.

Setting up Your Domain with Mailgun

From the dashboard page, there is a section called “Sending Domains”, here you will click on “Add New Domain”. Enter something useful. For example, if you had a website with the domain “example.com”, you would put something like “mailgun.example.com” in for your domain. This will use a subdomain for your email.

I recommend a subdomain so it doesn’t interfere with your main domain’s email system. You can set it up with your main domain, however, you may run into issues down the road unless you are really good with DKIM & SPF.

After you create your domain in Mailgun, you’ll get a series of records to add to your website. Since you’ve used a brand new subdomain, this won’t interfere with your domain’s regular email. There is an article with specific directions for setting up Mailgun with several common DNS providers.

Mailgun’s documentation doesn’t cover how to set up your domain using common cPanel hosting. So I recorded the below video showing you how to set up Mailgun with cPanel hosting DNS records.

If you can’t figure out how to set up your DNS, then contact your domain provider for assistance.

The above video shows you how to set up Mailgun with cPanel hosting DNS records.

Once Mailgun is set up with your DNS provider, you may be able to immediately verify your domain or it could take a while. If using Namecheap, GoDaddy, or Cloudflare it is normally 10-15 min before your records verify. If using a provider like Network Solutions, plan to wait a whole day (while you are waiting you can ponder why you are paying 3x as much for domains to get a fraction the service).

Setting up WordPress with Post SMTP

You need to make sure that your Mailgun has verified before you set your website to use it.

If you don’t wait, your website will still be broken and you will be frustrated.

Now that your domain is verified, time to configure Post SMTP. You could use other plugins, I just love responsive and helpful the developer of this one is, also the plugin rocks.

Just in case you were wondering after I finished these tutorials I deleted and recreated my subdomain so all of the keys were changed.

First, you’ll log into your WordPress dashboard and go to Plugins > Add New. You want to search for “Post SMTP”. Add the plugin and then activate it.

Once active, go to the Post SMTP in your left sidebar and click on “Show All Settings”.

On the Account tab, select “Mailgun API” under “Type”. Then put in your API Key and domain name. Only mark “Mailgun Europe Region” if you are in Europe.

Then click on the “Message” tab enter your email address, it should be the postmaster@ address you see on your Mailgun account. Then mark the box “Prevent plugins and themes from changing this”. Next put in your website name and mark the “Prevent plugins and themes from changing this” box. Now scroll down and click on “Save Changes”.

Now you’ll be back at the main Post SMTP screen. Click on “Send a Test Email” and send yourself a test email. You should receive it.

Once you’ve sent the test email, wait about 2 minutes and then go to Mailgun’s website and look up your email under logs. You should see a history showing the email both “Accepted” and “Delivered”.

As a bonus step, I recommend going into your email provider and whitelisting your postmaster@ address. Contact your provider for assistance as the setup varies widely.

Mail failed error email

Post SMTP has implement a very useful error notification email. This is sent when the website tries to send email, but can’t. One of the most common reasons you would get this email is because the email address that the person entered is invalid. Frequently this is a small typo. For example, they wrote .comm instead of .com. Or some other small typo.

Below is an example of the email that Post SMTP would send on an error — as you can see, this email address wouldn’t go anywhere.

You getting this message because an error detected while delivered your email.
For the domain: https://www.veincenterflorida.com
The log to paste when you open a support issue:
Invalid “Reply-To” e-mail address “someaddress@goooge.comm”

So if you get this email occasionally, don’t panic. It’s usually just people who can’t write their own email address.

Test email reputation

Now that your site is sending email, it’s time to test your email reputation.

  • Go to Mail Tester and copy the email address it gives you.
  • Next, go back to Post SMTP and send a new test email, this time to that address that Mail Tester just gave you.
  • Wait about 30 seconds after sending the message.
  • Then click “then check your score” button.
  • An 8 or better is what you are looking for.
  • If your score is less than 7 or so, then look into its responses for how to improve your score.

If you get a poor score and mail tester says that your emails probably won’t be delivered, then look into the response it gives you. Your DNS records may not be set up correctly, or you could have gotten a bad IP address from Mailgun.

In Mailgun you can usually change your IP address once on their free plan. If you can’t figure it out, contact their support.

Setting Contact Form Plugins

There’s nothing you have to do for your form plugins.

The way we’ve set things up with Mailgun & Post SMTP overrides the behavior of form plugins. It overrides all emails going from your WordPress site, so regardless of where in WordPress the email originates, you are covered!

Conclusion

Having WordPress unable to send email can be a pretty stressful situation, but the good news is that the combination of Mailgun and Post SMTP does a great job of not only fixing the problem but making sure you can track issues going forward.

20 thoughts on “The Best Way to Fix WordPress Mail for Good

  1. Thanks for the post. I only have one question. Why host providers do this? I was all fine until they decided to a server upgrade. (So much for an upgrade!) So after that no only I lost my database and the backups couldn’t be restored because of some sql problems, I also lost the ability to send emails from WordPress.

    So is it something for them in this to block mail() function?

    1. Shahab, hosting providers vary GREATLY in their quality of service, their technical skills, and their server update quality. Sometimes it’s laziness, lack of money to spend on proper upgrades, or just not really caring about their users.

      I always recommend keeping an offsite backup of your site using something like BackWPup or a service like ManageWP.

  2. Thanks, Gen.

    I was able to find an address using that medthod (ethnicelebs@domainsbyproxy.com), but it looks suspect to me. Sent an email and still haven’t gotten a reply. In either case, it’s super weird to me that WordPress would allow someone not to have email access…while the page clearly leaves an email form to contact the site at, and it appears to go through when you send the feedback. There are literally a “Contact Admin” form. How is it that that is allowed if it doesn’t go anywhere? You’d think WordPress would say that you either have an contact on your page or you don’t. But to have something that literally reads “Contact Admin” and then within that “Comments or questions are welcome.” is really kind of a cruel joke that probably shouldn’t be permitted.

    1. Oaken,

      Addresses at domainsbyproxy are using private registration. Basically, the info listed isn’t their actual address. It’s like using a post office box for your address when you don’t want to list your physical address. The domainsbyproxy will normally spam check and then forward emails that pass to whoever registered the domain.

      WordPress is open source software that people install on their own servers. It’s installed on a vast array of different server types and configurations. If a specific server doesn’t have email turned on that’s not the fault of WordPress. It’s like if you go buy a power drill, the company that made the drill isn’t responsible for how you decide to use it, you are. Same of WordPress, WordPress isn’t responsible for how a site owner chooses to setup a website, the site owner is.

  3. Hello,

    I do not have a WordPress account, but have been trying to sign-up with a site that uses WordPress to comment on their site. However, I’m never sent a confirmation email even though it says it sends it out. When I try the forgotten password function, I get the message you’re talking about. I’ve been trying to contact the site for YEARS, now, but to no response. They are either ignoring me or my emails aren’t even reaching them. I’ve used four or five different email addresses. It guess it’s possible all of them could block incoming mail from the WordPress site.

    Do you have any advice on how to remedy this?

    1. Oaken,

      The website you are trying to contact is unable to send email. That means it can’t send any email, so you should stop trying to contact the site. If you absolutely need to reach the site owners, you should look for alternative contact information such as a direct email address, phone number or other means. You can also put the domain name into whois.domaintools.com and do a lookup to see what information is listed as the website owner and try to email them directly.

    1. Yeah, I’ve dealt with HostGator before. They offer inexpensive hosting. For what you pay you do get decent servers, however, you don’t get any customer support. If you get sick of HostGator and want actual customer support and are willing to pay a couple bucks more a month (because you won’t get support from any company if you don’t pay a little more), check out SiteGround.

    1. Glad I could help!

      I’ve seen an increase in the lack of help from bluehost over the years. They used to be better and have gone downhill a lot.

  4. So so so many thanks..

    It took me whole day to figure out what was going on..
    Finally I did manage to get an error. Did have 1,5 hour chat with host.. nothing.. Realizing that I just the other day signed in for an account with Cloudflare.. Emailing back and forwards.. nothing.

    I was lost and stressed in the meantime.. Oke, I will hit the search button in Google one more time and there was your solotion… Happy now!

  5. Hi,

    I am having this issue, i have used SMTP many times, I have configured the setting correctly, but when ever I send message using ” Send all WordPress emails via SMTP. ” I eget an error but When ever I send test message via ” Use the PHP mail() function to send emails. ” I am able to send mail but I don’t get a response mail to the Email ID I used for testing.

    I can not figure this out, this happened to me first time.

    Can you help?

    1. If the PHP function says email was sent correctly and there are no warnings in the long response then the issue is most likely with the email address receiving — the emails were probably flagged by spam, and depending on how sensitive the spam filter, they may have been completely blocked by the spam filter.

      For the SMTP issue, you’ll need to contact your email provider & hosting company as there are some things that each of those can do which make sending email much harder.

    2. Hi, Thank you for the reply, that is the problem, my domain and hosting is new, this website is running for the first time and all the mail I have sent are sent for testing purpose which hardly may be 5 – 10 mails, and most of them to the test mail id for SMTP.

      That is why I can not figure out what is the problem.

    3. You’ll need to contact your hosting and email provider for assistance with SMTP & PHP mail. There are a lot of settings which can affect how SMTP & PHP mail work, most of these are only under the control of the hosting company. Issues with new hosting are caused by how the hosting company has configured everything — only they can assist you with those issues.

Leave a Reply

Your email address will not be published. Required fields are marked *