Cloudflare not sending WordPress email

How to Fix Cloudflare Not Sending WordPress Emails [or Timing Out]

Is Cloudflare not sending WordPress emails? Or are you seeing server timeouts when using SMTP to send email?

Sometimes moving to Cloudflare can cause problems with email sending in WordPress, but it’s easy to fix.

We’ll show you how below. But first, let’s figure out exactly what kind of Cloudflare email problem you have.

Fix Your WordPress Emails Now

Does Cloudflare Affect Email?

Cloudflare doesn’t directly affect email because it doesn’t handle SMTP traffic.

If you aren’t receiving any emails after switching to Cloudflare, it’s likely that there’s a problem with your DNS records.

Example of Cloudflare DNS

During the Cloudflare setup wizard, Cloudflare tries to copy the DNS records from your old host. You should compare the DNS records at your old provider with the details that Cloudflare has pulled in during the set-up procedure, paying special attention to the MX and A records.

If you have an A record for mail, it shouldn’t be proxied with an orange cloud icon. We’ll talk about this more in section 2.

In this article, we’ll move on from general email issues and talk specifically about Cloudflare email issues with WordPress websites.

How to Fix Cloudflare Not Sending WordPress Emails

We’re going to look at 2 different WordPress Cloudflare issues and show you how to fix them.

  1. Not Receiving WordPress Emails on Cloudflare (or Emails Going to Spam)
  2. Fix WordPress Timeouts with SMTP on Cloudflare

First, follow these step by step instructions to fix WordPress email deliverability issues.

1: Not Receiving WordPress Emails After Switching to Cloudflare (Or Emails Going to Spam)

If you’re having trouble receiving WordPress emails on Cloudflare, it’s easy to fix!

By default, WordPress sends emails through your web server using the wp_mail() function. This method is super basic, and the emails aren’t authenticated. So WordPress emails frequently get lost (or filed in the Junk Mail).

This isn’t directly related to Cloudflare, but changing your DNS configuration can sometimes produce unexpected results.

It’s easy to solve this problem with the WP Mail SMTP plugin. WP Mail SMTP will send your WordPress emails through a separate email service like Gmail or Sendinblue.

WP Mail SMTP

When your emails are routed through a separate email service, they’ll get the authentication they need to get through spam filters.

That will improve deliverability for your contact form notifications, WooCommerce store order emails, and other plugins.

WP Mail SMTP infographic

Let’s install the plugin now to solve the email deliverability problem you’re having.

Install WP Mail SMTP

To start, download the zip file from your WP Mail SMTP account so you can install it on your website. You’ll find it in the Downloads tab.

Download WP Mail SMTP to fix WPForms contact form not sending email

Next, open up your WordPress dashboard. Head to the Plugins page and upload the plugin to your WordPress site.

If you’re not sure how to do this, check out this guide to installing a plugin in WordPress.

Install WP Mail SMTP

As soon as you activate the plugin, the WP Mail SMTP Setup Wizard will open.

You can also re-start the wizard at any time by clicking the Launch Setup Wizard button in your WP Mail SMTP settings. Just know that re-starting the wizard later might reset your SMTP settings.

Choose Your Email Service Provider

Now we can choose a new provider to handle outgoing WordPress emails.

WP Mail SMTP lets you choose from different free or paid email providers. We recommend SMTP.com or Sendinblue because they’re reliable, and they’ll work well with most websites.

If you have a small site, you can use Gmail or Other SMTP. The Other SMTP option lets you use any mail server that you already have access to.

Click the Let’s Get Started button to begin.

Start the WP Mail SMTP setup wizard to fix WPforms not sending email

On the next screen, click the mailer you want to use in the list.

Choose SMTP to fix WPForms contact form not sending email

When you’ve chosen your mailer, open up our documentation to complete the setup steps on the provider’s side:

You can open the documentation in a new tab, then come back to this guide when you’re done.

Create DNS Records on Cloudflare

When you first set up Cloudflare, it copies your DNS entries from your old DNS provider. Now you have a new email provider, you might have been prompted to create some new DNS entries.

You can easily create these records by logging in to your Cloudflare account and selecting your domain.

Select domain to create a DMARC record in Cloudflare

Then you can go ahead and click the DNS icon to add the DNS records.

Open DNS in Cloudflare

Are you wondering: What are SPF, DMARC, and DKIM? We’ll add a brief description of these DNS records below.

Keep in mind that each provider has slightly different requirements. Not all records are required for every email provider. If you aren’t prompted to create a certain type of record for your email provider, you can skip it.

DKIM

DKIM electronically signs the emails sent from your domain.

Some providers need a DKIM so the email header can be validated, which proves your message is genuine and not spoofed.

SPF

The SPF record lists the servers that are authorized to send email from your domain.

It’s important that you only have 1 SPF record in Cloudflare.

You may already have an SPF record if you’re using other services with your domain. For example, if you’re sending email newsletters from an email address at your domain, you might have an SPF record for that already.

So to add your email provider, you’ll want to merge the content with the existing record.

Multiple SPF record rule in Cloudflare

To find out how to do that, read this simple guide on how to merge multiple SPF records.

DMARC

A DMARC record is responsible for routing mail that’s been flagged as spam by the mail server. It also sends reports to tell you the outcome of spam filtering.

New DMARC record in Cloudflare

Your provider should give you all of the details you need to create a DMARC record. If you need more help, check out this article on how to create a DMARC record. It includes a generic DMARC record that will work on most domains.

CNAME, TXT, MX

Some mailer services also require these records, although they’re less common than the other 3. If you don’t see these in your email provider’s setup instructions, you shouldn’t create them.

Send a Test Email From WordPress

Now you have your new mailer set up, you can go ahead and send a test email from WP Mail SMTP to check Cloudflare email in from WordPress.

Click the Email Test tab to start.

Test Cloudflare email in WordPress

And then send your test email!

Send test email from WP Mail SMTP

If everything’s set up correctly, you’ll see a green message.

Test Cloudflare email in WordPress - success message

If WP Mail SMTP detects any issues, it’ll show a warning.

Deliverability should be improved warning message

Below the warning, you’ll see information on the improvements you can make. For example, WP Mail SMTP will tell you if it can’t find your DMARC record.

Next, let’s look at the steps to follow if you experience a server timeout or a Cloudflare 524 error with SMTP.

2: WordPress Timeouts When Sending Email via SMTP on Cloudflare

If you’ve just switched to Cloudflare, or you’ve just set up SMTP for WordPress, you might notice timeouts when using Other SMTP in WP Mail SMTP.

When this happens, you’ll see errors like:

  • There was a problem while sending the test email.
  • Could not authenticate your SMTP account.
  • Could not connect to the SMTP host.
  • SMTP connect() failed.

Cloudflare may also display a request timeout or gateway error. The error code could be 500, 504, or 524.

WordPress timeouts with SMTP are usually caused by an incorrect proxy setting for your mail server A record in Cloudflare. Since Cloudflare can’t proxy SMTP traffic, we need to turn off the orange cloud for that line in your DNS.

To do that, open up the Cloudflare dashboard and open up the DNS records.

Open DNS in Cloudflare

Look for the A record pointing to your mail server. This will typically be called mail.

If the cloud icon orange and says Proxied, it means Cloudflare is trying to proxy your email traffic. This won’t work, which is why your WordPress SMTP is timing out.

You can see we have an orange cloud here to show that Cloudflare is trying to proxy SMTP traffc.

Orange cloud proxy for mail in Cloudflare

To fix this, you’ll want to edit the record.

Click on the cloud once to disable the proxy setting for the mail A record. When the cloud is gray, it will say DNS Only.

Turn off proxy for mail in Cloudflare

Click the blue Save button to save the change.

Now go back to WP Mail SMTP and try to send another test email to check that the timeout issue is fixed.

If you still have problems, take care to check the SMTP login details and the port number in your WP Mail SMTP settings.

Fix Your WordPress Emails Now

FAQ on Cloudflare WordPress Emails

Let’s look at some frequently asked questions about Cloudflare DNS and WordPress.

Do I Need to Create a PTR Record in Cloudflare?

No. PTR records are helpful for reverse DNS lookups, but you don’t usually need to create them. PTR records are normally handled by whoever manages your mail server. In most cases, this will be your web hosting company or email provider.

There are some situations where advanced users will manage their own rDNS. In that case, you’ll want to create your own PTR record. For more information, check out this article: What is a DNS PTR record (and do I need one)?

Do I Need to Use the Cloudflare WordPress Plugin for SMTP?

No. The plugin gives you extra details on your Cloudflare account, but you don’t need to install it for WP Mail SMTP to work.

Ready to fix your emails? Get started today with the best WordPress SMTP plugin. WP Mail SMTP Elite includes full White Glove Setup and offers a 14-day money-back guarantee.

If this article helped you out, please follow us on Facebook and Twitter for more WordPress tips and tutorials.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.