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.
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)
- 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 “firstname.lastname@example.org”
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!
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.