Email is arguably the most common electronic communication medium on Earth. It’s used for everything, from communication to alert notifications, to password reset flows and email-based Two-factor Authentication (2FA).
As a website owner sending email from your WordPress site, there are a few issues you’ll likely encounter. If you simply try and install a plugin to send emails on your website’s behalf, your email will almost certainly end up in the junk/spam folder, assuming the mail server even allows it through in the first place. What’s more, while PHP has a built-in mail() function to send email, some hosts disable this function, or have strict controls on how email is sent and how much of it is sent.
This is why even if you are in control of your email filtering settings, you may sometimes never get that email from your WordPress website — that email would have never been sent at all! To make matters more confusing, this may vary between plugins, themes, hosts, and an array of other factors.
The reason email delivery is not a straightforward affair is pretty simple — spam. The article gives an overview of the potential email delivery issues, and how to improve your WordPress email deliverability.
Why should I be concerned about WordPress email deliverability?
Making sure your WordPress website is sending emails which actually get delivered is vital for a number of reasons.
WordPress, the theme and many of the plugins you have installed on your website rely on email in several instances. Some of these instances are more apparent than others. Below are just a few of these instances:
However, that’s far from the end of the story for the use of email in WordPress. WordPress often requires users to act on information emailed to them. More crucially, some WordPress functions are aimed at site administrators, such as, alerting them of various errors or available updates.
When taking into account the myriad of plugins out there which rely on wp_mail() (a WordPress wrapper around PHP’s mail() function), it becomes quite clear that ensuring your websites can send emails that will get correctly delivered should be one every WordPress admin’s to-do list.
Common email deliverability issues
Emails ending up in spam
The emails sent from your website ending up in the spam folder of your users and customers is most probably the most common email deliverability problem. The reason for this is that reputable hosting providers don’t want to allow large volumes of emails to be sent from their IPs. Once IP addresses are marked as a spammy IP, hosting providers will have a tough time clearing IPs from various spam lists.
As a result, unless you are the sole recipient of emails from your website, and can therefore adjust your email client’s spam filter, you’re much better off using a managed service such as SendGrid, Mailgun or Amazon SES.
These services are specifically designed for email sending and aside from handling all the infrastructure and bounces for you, they make sure the IPs that are being used to send out emails are properly “warmed-up” and not present on any spam lists. Read on to find out how easy it is to integrate your WordPress with these services.
Your web host account does not allow you to send emails
Some web hosts take extra measures to ensure their networks are not sending spam emails. In some cases, web hosts disable the email sending functionality by default, and you have to manually enable it. If this is the case, you might need to contact your web host to enable email functionality. You can also manually enable it from your web host’s control panel.
Technical WordPress problems
Although not very common, a technical problem on your WordPress website might also be the reason why emails are not sent from your website. If this is the case, the best way to troubleshoot this is to disable all the plugins and switch to default theme and test WordPress email deliverability.
When you confirm emails are being sent, activate back your theme and enable the plugins one by one until you find the culprit that is causing the issue.
PHP misconfigurations are also a common reason emails don’t get delivered. It’s like posting mail without the correct address or stamp – it will never get delivered to the intended recipient’s mailbox.
How you configure the email settings in PHP will depend on your web server configuration or hosting provider. In most cases, you will be able to either configure PHP via the php.ini file, or via php_value options in an .htaccess file (if you’re running Apache HTTP Server with PHP running via mod_php).
If you are unsure how you should configure PHP on your website, consult your hosting provider’s documentation or technical support.
Heads up – Be careful when making changes to your PHP settings. Incorrect settings and syntax may damage your website. Always test your changes in a development or staging environment before making changes in production.
If you are configuring PHP via php.ini you need to search for the line that reads [mail function]. Once again, the configuration options here will largely depend on your hosting environment. For Windows users, it’s just a matter of configuring SMTP details directly within the php.ini file. For Linux users, you will likely need to install a Message Transfer Agent (MTA) such as Postfix and then configure PHP to use that.
If the above sounds too complex, or you’re not comfortable editing PHP’s settings, don’t be disheartened – read on.
cURL (and other software) errors
Apart from WordPress, there are many other software components and libraries involved in the process of sending an email through a website. There is PHP, a number of software libraries, the networking stack and the operating system, just to mention a few.
All of these need to be in correct working order. If one does not function well, the email will not be sent. As a website owner you might never need to configure any of these software components. Typically the web host manages these. However, it helps to at least be aware of them.
The component that gives most problems on WordPress websites and web hosts is CURL. CURL is a library used on web servers to initiate network connections, in this case to send emails. CURL per se is a very reliable library. However, it might not be installed correctly on your server, or you might be using an old version. Should you encounter a CURL or software specific errors, contact your web host.
Missing or Incorrect DKIM and/or SPF records
DKIM (DomainKeys Identified Mail) and SPF (Sender Policy Framework) are two technologies designed to help reduce email spoofing and phishing.
While not required, DKIM and SPF make email more legitimate and therefore make it harder to “spoof” email from another domain. By having emails cryptographically signed using DKIM and validated using an SPF policy, emails are much less likely to go to junk or spam folders.
If you’re using an email sending service such as SendGrid, Mailgun or Amazon SES, refer to their documentation on how to set these DNS records (if you are not familiar with DNS, read our guide on DNS for WordPress websites and administrators). If you are using your own SMTP server, you may need to refer to that SMTP server’s documentation on how to set up DKIM and SPF.
Testing WordPress email configuration settings
Fortunately, it’s simple to inspect your site’s and domain’s email setup with a free WordPress plugin called WP Mail SMTP by WPForms. With this plugin you can kill two birds with one stone:
The following section explains how to install the plugin and test the email deliverability of your WordPress website.
Installing the plugin
Getting started is quick and easy – navigate to Plugins page and click Add New in your WordPress dashboard. Search for “WP Mail SMTP” and install and activate the plugin. You can’t miss that plugin logo with the pigeon!
Sending a test email
If you installed the plugin just to run the tests, skip the wizard and click the WP Mail SMTP menu entry, and click on Email Test.
Here you can specify to whom to send a test email and if it should be an HTML or plain text email. Click Send Email to send the test email. The test is as simple as that.
What happens during the email test?
To you, the plugin user, the test is as easy as ABC. However, underneath the hood the plugin does a lot more than any other email testing plugin. It runs a series of tests to check both your website’s and domain’s setup. Additionally, it will alert you in case there are any technical issues.
In the first phase of the test the plugin checks if there is a hard pass or fail. If there is a failure right off the bat, a failure with wp_mail() or the PHP mailer, the plugin parses the error and suggests practical solutions that any average user can understand.
The plugin does not stop there even once the email is sent. WP Mail SMTP runs further checks to confirm the setup of the domain’s DNS. It checks and confirms that the SPF records, DKIM, the DMARC records are all set up correctly.
Most probably your emails will end up in the recipients’ spam folder, if you haven’t configured these DNS records correctly. That’s the reason why these DNS checks are really important.
Improving WordPress email deliverability and avoiding the spam folder
Even with all the correct settings, you may still encounter deliverability issues. This is especially the case when using shared hosting, where multiple websites are making use of the same IP address.
Fortunately, services such as SendGrid, Mailgun, SMTP.com and Amazon SES make it a trivial process to send large volumes of emails, with a very low rate of deliverability issues while also automatically handling bounce complaints.
Integrating WordPress with an Email service / SMTP server
Integrating your website with an email service is as easy as ABC with the WordPress plugin WP Mail SMTP. The plugin makes it quick and simple to use a wide variety of SMTP mail providers. or any generic email provider which supports the SMTP protocol, the protocol used to send email.
You can use the free plugin to connect your website and use SMTP.com, Sendgrid, Mailgun, Gmail and SendinBlue. However, you can use WP Mail SMTP Pro to use any other SMTP service, and benefit from many other features, such as reports, priority support, email controls and much more. Refer to the WP Mail SMTP pricing page for a complete list of all the features available in the Pro edition of this WordPress plugin.
With the wizards you can connect to an email service within seconds
As you can see on the screenshot below, with the wizard you can configure everything. This is actually a screenshot of our website’s setup.
Email deliverability may not immediately sound like the highest priority for WordPress admins to be concerned about. However, you’ll thank yourself that you took the time to set up email properly in WordPress when you need to send your customers and website users newsletters, password reset emails, 2FA codes, or receive important updates about your WordPress blog.
Do you need help with your email setup?
If you are stuck, do not know where to start, encountered some technical issues, or simply you are not bothered about setting up a reliable email system by yourself, upgrade to WP Mail SMTP Pro, so you can request white glove support – their team will configure everything for you within a few hours.
This content was originally published here.