Cloudflare not sending WordPress email

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

Editorial Note: We may earn a commission when you visit links on our website.

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 setup procedure, paying special attention to the MX and A records.

If you have an A record for mail, it should not be proxied. You’ll know it’s proxied if it has an orange cloud icon next to it.

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

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 SendLayer or Brevo (formerly Sendinblue).

WP Mail SMTP 3 million active installations

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 Email Deliverability illustration

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 restart the wizard at any time by clicking the Launch Setup Wizard button in your WP Mail SMTP settings. Just know that restarting 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 SendLayer, SMTP.com, or Brevo because they’re reliable, and they’ll work well with most websites.

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 from the list.

Choose SMTP Mailer

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

Mailers available in all versions Mailers in WP Mail SMTP Pro
SendLayer Amazon SES
SMTP.com Microsoft 365 / Outlook.com
Brevo Zoho Mail
Google Workspace / Gmail
Mailgun
Postmark
SendGrid
SparkPost
Other SMTP

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

Want to set up multiple mailers? You can do so in the Additional Connections settings once you’ve finished the Setup Wizard. Then you can select a Backup Connection and configure Smart Routing.

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 emails 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.

Enable Email Logging

After you set up your mailer, the Setup Wizard will show you the WP Mail SMTP features you can turn on. By default, Improved Email Deliverability and Email Error Tracking will be enabled.

Enabling email logs and email alerts in the WP Mail SMTP Setup Wizard

In WP Mail SMTP Pro, you can also enable Detailed Email Logs to track the delivery of all the emails sent from your site. You’ll be able to see their status in the WP Mail SMTP dashboard widget.

WP Mail SMTP dashboard widget

Turning on email logging automatically enables Complete Email Reports as well. And you can see an overview of your recent email stats in the Weekly Email Summary.

Another handy feature you can enable here is Instant Email Alerts. These notifications will let you know if your site fails to send an email so you can efficiently fix the problem.

An email alert notification

Finally, in the last step of the Setup Wizard, you can enable advanced email logging features.

Configuring email log settings in the WP Mail SMTP Setup Wizard

These features let you store email content and attachments and track email opens and link clicks.

For all the details, see our guide to WordPress email logging.

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 the Other SMTP mailer 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. You can find out more about what these and other common SMTP error codes mean over on the SendLayer blog.

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 orange cloud icon 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 traffic.

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.

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.

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

Next, Troubleshoot WordPress Emails With Error Logs

Want to make troubleshooting your WordPress emails easier? Check out our guide to using WP Mail SMTP error logs.

And if you want to see how WP Mail SMTP stacks up against other solutions, try our list of the best SMTP plugins for WordPress.

Fix Your WordPress Emails Now

Ready to fix your emails? Get started today with the best WordPress SMTP plugin. If you don’t have the time to fix your emails, you can get full White Glove Setup assistance as an extra purchase, and there’s a 14-day money-back guarantee for all paid plans.

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

Comments

  1. I am very grateful with this post, it helped to me to maintain Cloudflare service and finally our email works correctly.

    All the best.

  2. Hello.
    I have installed your nice plugin and am using «other smtp» sender.
    I am using a shared host and connected it to cloudflare.
    But no matter what settings I put, the email is not sent.
    Please let me know what I should put in the SMTP settings of the plugin and Cloudflare.
    Thanks.

    1. Hi There,

      Please get in touch with your hosting support and request your SMTP configurations.

      Then, configure the WP Mail SMTP -> Settings page and try sending a test email.

      I hope this helps. Thanks!

Add a Comment Cancel reply

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.