WordPress can send emails but sometimes it does not go as smoothly as expected. There are many reasons that can cause WordPress not sending emails. Also, this is one of the most common issues among WordPress users. In this article I would like to share our experience with this issue.
By default, WordPress uses the PHPMailer functionality to send emails from your WordPress installation. For example, it can send an email if one of your users has requested a password reset. In this case, WordPress will send an email with login information for that specific user.
The causes of the issue
The sources of the issue can be different. Sometimes, there might be a problem on the server which can cause WordPress not sending emails. In this case, you’ll need to contact your hosting provider to investigate the issue. Note, this is the last step that you should do once you’ve tried other solutions and they have not worked.
In most of the cases, the reason why the email functionality does not work as expected is an incorrect email setup on the WordPress installation, or there is some kind of an incompatibility on the site. The good thing is that it is possible to fix it by using a 3rd party plugin.
Our case: emails are not delivered to intended recipient
Recently, we’ve noticed that many of our customers do not receive emails after the purchase is made. The weird thing is that WordPress is sending those emails. We know it because some of the customers are able to receive emails from us. Moreover, we also get copies of those emails once the purchase is made.
I am thinking that some providers (or their systems) may just block email from our domain by thinking that it is some kind of spam. As a result, the email cannot be delivered to the recipient. The email is sent but it just does not reach its final destination.
Run an email test on your server
You can check if your WordPress site is able to send emails by using the Check Email plugin. The plugin is designed to send a simple test email to an email address of your choice. Make sure to check your spam or junk mail folder.
If you’ve received an email then it means that WordPress is able to send emails from your web server. On the other hand, there might be a case similar to one that we’ve had when WordPress sends emails but they have been stopped somewhere on a way to the recipient.
As it was mentioned previously in this article, it is possible to fix the issue by using a 3rd plugin. I am going to share a solution that has helped us to solve our problem but it can also solve the issue when WordPress is not able to send emails.
To solve our problem, we have started to use SMTP (Simple Mail Transfer Protocol). To do so, first you need to install a plugin called WP Mail SMTP. We have used a free version of the plugin because we simply do not need those premium features.
The plugin comes with various SMTP providers. You can choose whichever works best for your needs. You can learn more about the plugin installation and SMTP setup options by referring to a documentation of the plugin.
As for us, first we’ve tried Gmail SMTP. When we tried to connect our site to Gmail API, we got “403 forbidden” error. It was solved by temporarily disabling firewall (mod_security) on the server. We’ve switched the firewall on again after authentication of the mail setting.
After that we’ve got another issue. It’s not possible to set the “From Name” when using Gmail SMTP option. For example, if your email is firstname.lastname@example.org, then the sender name appears as “donotreply” and you cannot change it because API does not allow you that.
So, we’ve decided to switch to SendGrid. As for me, the integration process for this option is much simpler. Also, it does not cause any server errors when authorizing the service on the site. Moreover, the “From Name” works as expected.
Currently, we are satisfied with this option and hope it will help to resolve the issue when emails are not delivered to the recipient. Have you ever experienced the issue that we’ve had? If yes, please share your solution in the comment section.