We all know how to send an email, but what can we do if sending mail does not go as smoothly as expected?
One of the common issues beginner developers have to deal with is WordPress not sending email correctly. And while this can be solved quite easily, if you have never dealt with an issue of this sort, you probably don’t know all the simple fixes that will work here.
So without further ado, let’s talk some more about WordPress email plugin, the send mail error, why it occurs, and how to fix it.
WordPress Email Fail: The Most Common Situations
Using WordPress comes with many perks, but there are also some situations and issues that you need to know how to deal with. Here are some of the most common situations connected to the site mail issues:
- Using Contact Forms: It has been noticed that in some cases when a visitor submits a contact form using a default form or a 3rd party contact form (e.g., Contact Form 7), there is a chance you will not receive an email notification that they submitted the form.
- When WordPress Sends Your Notifications: In WordPress email settings, you can choose to have your notifications sent automatically. This includes emails notifying you of new user registrations, password resets, blog post comments, automatic updates, and more. However, sometimes, it will not work properly.
- Using 3rd Party Plugins: Notifications from popular plugins like WooCommerce and WPForms are often missed as a result of WordPress not sending email. The messages either never get to your inbox or they get marked as spam.
But why do the problems in these situations occur? Find out more about that below.
Why You Are Not Getting Emails from Your WordPress Site
There is a number of reasons why the WordPress send email error occurs, but the most common one is that your hosting server is not configured to use PHP mail() function.
Even if you would be able to send emails without the send email PHP function, there is a number of tools meant to detect if an email is coming from the location it is supposed to. Emails sent by WordPress sites occasionally fail this test.
This is why we are not fans of WordPress sending emails, and we recommend using SMTP for registration emails, newsletters, and similar.
SMTP aka Simple Mail Transfer Protocol is the safest and best way to fix the can’t send email issue. Unlike PHP mail function, SMTP uses proper authentication which increases email deliverability.
You can choose from a sea of SMTP services available, but today, we are going to focus on the two services of our choice: MailGun and Gmail.
Fix WordPress Not Sending Emails
Everyday situations of WordPress not sending email might include submission to a contact form that you never receive, or a third-party plugin notification. This could also apply to WooCommerce not sending emails from recent sales or customer inquiries.
The cause of these issues is usually hidden in the incorrect settings in the plugin, or in the incompatibility with PHP7, HHVM, and similar. Let’s take a look at some quick solutions now.
Test Email on Your Server
A free tool such as the Check Email plugin can be handy to test WordPress sending email. Use it to test WordPress emails and ensure that there isn’t any email issue.
The tool itself is super easy to use; just install it and send a test email to see if everything is working correctly. An issue such as emails not sending should be detected instantly.
Check your email client to see if you received the test email. The subject line will appear as “Test email from https://yourdomain.com.” Also, make sure to check your spam or junk mail folder.
If you find the sent email, it means that the emails not sent in the past were probably a result of a misconfiguration with your contact form plugin or an incompatibility. You can always play around with the WordPress mail settings to try and fix that or contact the plugin developer for help.
Configure Gmail SMTP in WordPress
Out of all email options, using a good WP mail SMTP is probably the best way to avoid the email not sending issue.
We would recommend you to enable SMTP Gmail as your default WordPress SMTP. Not only will your WordPress mail be sent but the deliverability will also be increased by preventing the mail from ending up in the junk or spam folders.
Keep in mind though that the free version, your WordPress send emails option is limited to the maximum of 100 emails per day (3,000 free emails per month). If you need to send out more emails, you can increase these limits by paying for G Suite.
Another option is to choose another SMTP WordPress such as Mailgun. This will provide you with more free emails every month, but you will not get all of Gmail’s features, on the other hand.
So let’s go through the steps of configuring your Gmail SMTP WordPress.
The first steps are to download and install the free plugin called Post SMTP (previously Postman SMTP). This plugin has 5 out of 5-star rating and is known to work beautifully with WooCommerce and Digital Downloads.
In this example below, Gmail is being used as an SMTP server to send emails for the WordPress installation. We will be using the OAuth 2.0 protocol to authorize access to the Gmail API – which means a more secure login system and users will not have to enter any username or password.
Once you have installed this WordPress SMTP plugin, in the Post SMTP setup click on “Start the Wizard.”
Input your name and the email address you want to use to send emails and click “Next.”
Now you have to enter the outgoing mail server hostname. In this example, we are using smtp.gmail.com. Then click “Next.”
Now it is the time to configure the connection. We will be using the “Gmail API” in this example because some hosts might be blocking the default ports as we mentioned earlier in this article.
You will then need to open up a new tab and create a new project with Google. Go to console.developers.google.com and log in with the Gmail you will be using to send emails. You will then need to create a new project.
Choose a name for your project and click on “Create.”
In the dashboard of the new project click on “Enable APIS and Services.”
Then click on “Gmail API” under G Suite APIs.
Then click on “Enable.”
Then click on “Credentials” on the left-hand side. And then under Create credentials choose “OAuth client ID.”
On the next screen, you will need to click on “Configure consent screen.”
At this point, you will get your client ID and client secret.
Copy and paste these into the Client ID and Client Secret fields in the Post SMTP wizard. Then click “Next” and then “Finish.”
To ensure that your domain is verified, add it to the Google Developer Console.
You will then need to “Grant permission with Google” and click to allow your Gmail account access.
Ending thoughts on how to solve the issue of WordPress not sending email
For several reasons, you will have trouble with the WordPress not sending email. However, with the right WordPress email setup, this can easily be avoided.
Consider using SMTP for sending the mail, and you should have significantly fewer cases of WordPress not sending emails. In this article, you will find a handy guide with all the steps necessary to set up an SMTP for sending out mail.
If you enjoyed reading this article about WordPress not sending email issue, you should also read these:
- CDN Services you could use to speed up WordPress
- WordPress Database Plugin Options to Speed up Your Database
- WordPress cache plugin options to test for your website