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.
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.
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
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
In This Article
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.
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.
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.
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.
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.
Click the Let’s Get Started button to begin.
On the next screen, click the mailer you want to use from the list.
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|
|SMTP.com||Microsoft 365 / Outlook.com|
|Google Workspace / Gmail|
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.
Then you can go ahead and click the DNS icon to add the DNS records.
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 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.
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.
To find out how to do that, read this simple guide on how to merge multiple SPF records.
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.
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.
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.
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.
Finally, in the last step of the Setup Wizard, you can enable advanced email logging features.
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.
And then send your test email!
If everything’s set up correctly, you’ll see a green message.
If WP Mail SMTP detects any issues, it’ll show a warning.
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.
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.
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.
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.
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.