One of the most troubling issues that crop up from time to time with our customers is when email notifications stop getting delivered. This is especially concerning for our WooCommerce customers who rely on email notifications to communicate with their customers and make sure orders are getting processed.
How notification emails are sent
WordPress, WooCommerce, and most other plugins that send mail use the wp_mail function to send mail. It is a core function of WordPress itself and is similar to PHP mail, allowing email to be sent using a PHP script.
Test if wp_mail is working
If the site has been sending emails but suddenly stops, it’s likely that wp_mail is functioning fine. But if you aren’t sure or have never received an email from WordPress, it’s worth testing if the function is working at all. Chad Butler wrote an article and simple script to make it easy. Basically, you upload the script to your website and browse to the file. If wp_mail is working, you’ll see a success message and get an email in your inbox. If not, then it’s time to start troubleshooting problems with your server and contacting your host.
The rest of this article will assume that wp_mail is working properly.
Check if emails are sent, but not received
It’s not very easy to know what WordPress and WooCommerce notifications are being sent out, especially to customers. If you’re sure that emails are enabled but not if they are being received, a mail logging plugin is a good place to start. WP Mail Logging is a plugin that will log all outgoing emails.
Once you install the plugin:
- Generate a test order
- In your dashboard, go to > WP Mail Log
- Check if the test order generated any emails, and check for errors.
You will hopefully see that a couple of notifications went out, one to the customer and one to the store admin. You can even view the emails as they would appear to the recipient.
If the emails were sent but not received, there may be an issue with spam blockers classifying your emails as spam. If you are using Gsuite to host your email, Google sometimes can block email sent from a domain to an email account with the same domain. While there are workarounds, one good way to resolve this is by using a dedicated SMTP provider.
Dedicated SMTP Providers
A dedicated SMTP provider is a service somewhat like a web host, but instead of hosting your website, you use their servers to send emails. You have an account and can log in to check the mail logs and other stats, depending on what service you use.
Here’s a short list of dedicated SMTP services. Each has a dedicated WordPress plugin for easy configuration:
- SendGrid (Plugin) – Send 40,000 emails for $9.95 per month.
- Mailgun (Plugin) – Send 10,000 emails for free per month.
- SparkPost (Plugin) – Send 50,000 emails for $9.00 per month.
Further Troubleshooting
After following the above advice you should hopefully be on your way to receiving email notifications. If you are still having issues, the problem may go deeper than can be explained here. Whether they are being blocked by spam filters or a plugin is causing a fatal error, most of these will need a deeper investigation into server logs.
Let us know in the comments if this has helped you, or if you’ve got something to contribute!