Blog

How to send emails in WordPress

Šarūnas Ročevas
· 8 min read · Tips and resources · November 11th, 2021
Sending transactional emails through WordPress blogs or websites can be unreliable. Learn what you need to do to make Wordpress send emails every time and ensure they land in the inbox.

WordPress blogs and websites have a reputation for unreliable email sending. Because every WordPress host configures email sending differently, you can never be sure if your emails will reach the inbox or if you get incoming emails from leads! Thankfully, you can fix issues with WordPress sending emails by integrating your WordPress site with a trusted email service like MailerSend.

Note: If you’re using WooCommerce for your e-commerce store, learn how to resolve email sending issues using MailerSend’s email API and official WooCommerce plugin. Our blog article explains how: ​​WooCommerce not sending emails every time? Here’s how to fix it.

How does WordPress send emails?

When configured out of the box, WordPress doesn’t actually send emails because it has no email server capabilities. WordPress is a content management platform. It wasn't designed to be an email service, so it relies on the web host to send messages—like contact form submissions, invoices and email notifications—on its behalf.

To troubleshoot Wordpress sending emails, let’s take a look how emails are sent from WordPress:

How WordPress sends emails

1. WordPress prepares to send your email using the wp_mail() function below, specifying the recipient, subject, message contents, and any attachments.

wp_mail( $to, $subject, $message, $headers, $attachments );

2. The mail function then calls PHP’s built-in mail() function, part of the PHPMailer library, that instructs the mail server at the WordPress host to send the email.

mail(to, subject, message, headers, parameters);

3. The WordPress host will attempt to deliver your email with varying results, sometimes landing in the spam folder or not sending it at all.

Instead of relying on the web host as a mailer, many WordPress users install a third-party SMTP plugin like Easy WP SMTP or WP Mail SMTP by WPForms. The plugin tells WordPress to send emails using Simple Mail Transfer Protocol, so the email delivery is handled by an SMTP host like Gmail SMTP instead of your web host.

4 most common WordPress email issues

There are many reasons why you might be having trouble with Wordpress sending emails. Here are some common reasons and how you can fix them.

1. WordPress host is not configured for email sending

Email deliverability with WordPress can be a hit or miss if you’re not using an SMTP plugin. This is because the PHP mail function that WordPress depends on is configured differently for every host. Some WordPress hosts even disable email sending to stop spammers!

To check if your WordPress host is properly configured for email sending, you can install the WP Mail Logging plugin to log all outgoing emails. Send a test email then go to WP Mail Log under the Tools menu. A successfully sent email will look like the following screenshot without any errors in the Error column.

WP Mail Logging log

For WordPress email errors, you will either need to debug your email configuration settings if you’re self-hosting, or contact the technical support team at your WordPress hosting provider.

Remember: Depending on your WordPress hosting plan, your hosting provider may be reluctant to make changes to their email settings to resolve your sending issues. Any changes may negatively affect other customers sharing the WordPress server as well.

2. WordPress emails are going to spam

If WordPress is sending emails but people are not receiving them, the receiving email server may be blocking your emails or sending them straight to spam. A mismatch between your sending domain and “From” email address, or even the contents of your email message, may be raising deliverability red flags with spam filters.

Check your email sender options

To avoid your emails being marked as spam by inbox providers, your From name should be a legitimate email and it should match your WordPress website’s domain name. For example, if your WordPress site is summerbobsleds.com then your “From” address should be tom@summerbobsleds.com and not summerbobsleds@gmail.com.

If you’re using the built-in wp_mail() function to send emails, you can specify the sending email with the $from_email parameter. For third-party WordPress SMTP plugins, you can check the email sending options by going to the plugin’s settings page. For Easy WP SMTP, navigate to Settings and then Easy WP SMTP to see the following.

Easy WP SMTP settings

Check your email message contents

Your WordPress emails may be blocked by spam filters such as SpamAssassin because of spam-like content. Avoid spammy words like “Your FREE account is ready!” in your email subject line and message body. Also, ensure that your email body is not made up of a single large image or that you’re not using ALL CAPS text.

Spammy subject lines
Use an automated tool like MailerCheck, our partner in email list cleaning and inbox optimization. Send a test email to MailerCheck to generate a report highlighting potential deliverability issues like broken links, invalid HTML code, and much more. Learn more with this article: Improve your deliverability even more with Inbox Insights.

Authenticate your sending domain

Spam filters also check if your sending domain is properly authenticated. A domain with missing authentication records rings alarm bells because the person sending the email may not be who they claim to be, raising suspicion that it may be a spammer or bad actor.

When you add new sending domains to MailerSend, for example, you are required to create SPF and DKIM records and add them to your DNS zones. You will not be able to send emails until you complete this step, reassuring inbox providers and recipients that emails are being sent from your email account.

Domain verification step

3. SMTP servers are returning errors

If you’re sending with a third-party SMTP plugin and you see an exclamation mark in WP Mail Logging like the following screenshot, it means that an SMTP error was returned by the receiving mail server. 

WP Mail Logging error

To investigate further, click the View button and then click Raw to read the error message. Unfortunately, it can be hard to interpret SMTP error codes because these codes are configured differently between mail servers.

WP Mail Logging error details

In this example, “SMTP Error: data not accepted” may mean any one of the following errors:

  • The recipient’s mailbox is full

  • Your sending command contains errors

  • You have exceeded your daily sending quota

  • Your server is sending too many emails at the same time

4. Conflict between WordPress plugins

If the first three troubleshooting options don’t fix the issue with WordPress sending emails, there may be a conflict between WordPress plugins. Contact form and SMTP plugins, for example, can sometimes conflict with other similar plugins in your configuration. To verify this, you will need to deactivate all of your plugins and then reactivate them one by one until you can successfully send emails.

WordPress plugin conflict

How to send emails from WordPress with confidence

Troubleshooting will help you solve immediate email sending issues, but it’s not the best solution in the long-term. You can ensure that your WordPress emails get delivered every time by using a reliable SMTP service like MailerSend.

The deliverability experts at MailerSend understand what it takes to land in the inbox every time. Together with advanced sending infrastructure and a spotless sending reputation, you can leave it to the experts to take care of your email sendings.

Choose from sending emails using an SMTP plugin of your choice or by installing the official SMTP plugin from MailerSend.

1. Use your preferred SMTP plugin

First, sign up with MailerSend if you don’t already have an account. Add a sending domain and then retrieve your SMTP login details at the domain’s page. For optimal email deliverability and security, best practices are automatically applied such as using SMTP port 587 and TLS for the connection. Click on each field to copy it.

MailerSend SMTP credentials

Next, install an SMTP plugin of your choice from the WordPress dashboard. We’ll use Easy WP SMTP as an example here. Once installed, go to Easy WP SMTP under Settings. At the SMTP Settings tab, paste your SMTP credentials from MailerSend.

Easy WP SMTP settings
Depending on your SMTP plugin, choose STARTTLS if you see the option because it will automatically upgrade a plain text connection to an encrypted one. Otherwise, you can choose SSL/TLS.

To check that WordPress is sending emails, you can test your SMTP settings by going to the Test Email tab. Enter a recipient email address and then click Send Test Email to check that email is being sent using MailerSend’s SMTP server.

Easy WP SMTP test email

2. Use MailerSend’s SMTP plugin

The MailerSend plugin for WordPress allows you to send emails using a reliable SMTP server. The official plugin saves you time as you only need to enter your SMTP username and password to get started, leaving you to focus on important fields like your sender details and email recipients.

Install the plugin by searching for MailerSend – Official SMTP Integration. Activate it and then go to MailerSend SMTP in the sidebar. Enter your SMTP credentials from MailerSend under SMTP username and password and then click Save.

SMTP username and password

Under Sender details, enter your name and email address along with any other recipients in the CC, BCC and Reply-to fields. Click Save when done.

SMTP sender details
For best deliverability results, the Sender address domain must match the sending domain where you obtained the SMTP credentials.

Check to see that MailerSend is sending emails from WordPress by clicking the Test button.

SMTP test email

Congratulations! 🎉 You just added SMTP sending to WordPress with these two options. From now on your WordPress emails will be sent through MailerSend’s SMTP server instead of through your web host. As a bonus, you can also track all email activity on the Activity page in your MailerSend account.

For more information about how to enable SMTP in MailerSend, visit the How to send emails via SMTP with MailerSend article.

Take control of your WordPress emails

WordPress is a powerful and popular publishing platform for blogs and websites, but it lacks a built-in email infrastructure. That’s where an email service provider like MailerSend comes in. By combining WordPress and an email tool with proven deliverability, you’ll deliver a positive experience for every website or blog visitor.

How are you sending emails from WordPress? Share in the comments below.

Šarūnas Ročevas
Designer
Stop War! Help Ukraine! See what you can do