Fix multiple SPF records

Multiple SPF Records: How to Merge Them (The EASY Way)

Do you need to fix multiple SPF records on your domain?

SPF records are TXT type records starting with v=spf1. Multiple SPF records can cause your emails to be rejected or filed as spam, so you’ll want to merge them into one line.

We’ll show you how — the easy way.

Fix Your WordPress Emails Now

What Happens If You Have More than 1 SPF Record?

If you have multiple, separate SPF records for a single domain, your emails will fail SPF authentication and return a PermError.

According to Alexa, one in 6 domains with an SPF record uses the wrong format, so this is a pretty common issue, and it can be hard to spot.

Multiple SPF records in Cloudflare

You might not even know your SPF records are invalid. If you have two or more, they are often all ignored, which is bad news for email deliverability.

The simple fix is to merge these multiple TXT records into a single line. This is an easy problem to solve, and it only takes a few minutes to combine your SPF records.

How to Fix Multiple SPF Records

To begin, we’ll check your DNS records with a free online tool.

Check For Multiple SPF Records

We’ll start by using a free tool called MXToolbox to scan your DNS records for more than 1 SPF record.

To do this, type your domain name into the field and click the SPF Record Lookup button.

Check MXToolbox for multiple SPF records

If you have more than 1 SPF rule set up, you’ll see the message More than one record found. The SPF records are shown in the red bars at the top.

Multiple SPF records error in MXToolbox

As you can see, 2 lines are start with v=spf1, which is why we’re seeing an error. A receiving mail server won’t know which rule to follow, so it will ignore both.

To solve the issue with your SPF records, we’re going to edit your domain’s DNS records and combine multiple SPF TXT records into one.

You’ll need to open up the control panel for the company that hosts your DNS. In most cases, DNS records are held by:

  • Your domain registrar (the company you bought your domain name from)
  • The web hosting company you’re using, if you bought your hosting and domain as a package
  • A CDN provider, if you’ve chosen to use a CDN. Cloudflare is one example.

You may have already edited your DNS when you created DMARC, SPF, and DKIM records for your transactional email provider. We’ll recap on that process so you can merge your SPF records now.

Example 1: SPF Records in Cloudflare

Each provider’s control panel will look slightly different.

We’ll show you how to fix multiple SPF records using Cloudflare first. To start, log in and select the domain you want to edit.

Open DNS in Cloudflare

You’ll see your entire DNS listed. Look for the TXT records to find the duplicates.

Multiple SPF records in Cloudflare

If your DNS doesn’t look like this, let’s try another way of finding the right records.

Example 2: SPF Records in Bluehost

Bluehost uses cPanel, so this example should be easy to follow if you’re using a similar host.

First log in to your hosting control panel. From the left-hand menu, click on Domains.

Edit Bluehost domains

From the list, click the Manage dropdown next to the domain you need to edit.

Manage domain to merge SPF in Bluehost

From the menu that pops out, click on DNS.

Bluehost edit DNS

Now scroll down until you find your TXT records. You’ll see the SPF records in this section.

Multiple SPF TXT records in Bluehost

Again, your DNS records may be laid out in an alternative format, but most cPanel hosts have similar menus with varying colors (skins). Even if your hosting account looks slightly different, the screenshots above should help you find them. If not, reach out to your host.

How to Include Multiple SPF Records in 1 TXT Record

Now we’re going to use the correct syntax to merge all SPF records into one TXT entry. This will allow you to use multiple IPs or domains in 1 record, resolving the error we saw earlier.

We’ll use Cloudflare in this example, but the steps are similar for most hosts and registrars.

Look to the DNS zone and find the first SPF rule. Click Edit.

Edit multiple SPF records in Cloudflare

Copy the existing rule to a blank text document on your desktop so you can grab it again in a second.

Now delete that record from your DNS.

Delete duplicate SPF record

In Bluehost, you can delete the record using the icon to the right with the 3 dots, then clicking Remove.

Delete SPF Bluehost

We’re going to switch back to Cloudflare for the rest of these steps to make it easier to demonstrate.

Click Edit next to the second SPF record.

Edit SPF record in Cloudflare

Now we’re going to merge the SPF record from your text file into this one.

An SPF record has 3 sections: the declaration, the allowed IPs or domains, and an enforcement rule. So we’re going to combine the records like this:

  • Declaration: Start your SPF record with v=spf1 (don’t use this again in the rule — it must only appear once, at the start)
  • Allowedins: Add an include lookup for each domain, like this: include:zoho.eu include:mailgun.org
  • Enforcement rule: End the record with one ~allstatement (again, only use this at the end of the rule, and only add it once)

Once we’ve combined the SPF rules, our combined record looks like this:

v=spf1 include:zoho.eu include:mailgun.org ~all

Go ahead and save your SPF record.

Combined SPF rule in Cloudflare

As long as you only have 1 declaration at the start, and 1 enforcement rule at the end, you can include more domains if you need to. Just be sure to format them in a single line. Here’s an example:

v=spf1 include:zoho.eu include:spf.brevo.com include:mailgun.org ~all

While you can keep extending the record, keep in mind that there are some limits:

  • The statement can have a maximum of 10 domain lookups (e.g. include)
  • The statement must be less than 255 characters long.

Don’t forget to Save before moving on.

Test Your Merged SPF Records

It can take up to 48 hours for DNS changes to propagate, although Cloudflare changes often take effect in a few minutes.

Once you’ve waited a while, check your domain name again in MXToolbox.

You should now see a pass message similar to this one.

Valid merged SPF records in MXToolbox

And that’s it! You successfully fixed the problem of multiple SPF records on your domain.

What If I Still See an Error?

If you still see an error like too many lookups, there may be multiple lookups going on for each domain in your SPF record. In other words, every domain has its own include statements and the total number is exceeding the maximum allowed.

You can solve this by flattening your SPF record.

Fix Your WordPress Emails Now

Frequently Asked Questions on SPF Records

Let’s finish up with a little more background information about SPF records.

What Does SPF Mean?

SPF stands for Sender Policy Framework. The full specification is defined in a technical document called RFC4408.

What Does an SPF Record Do?

SPF validates your outgoing email messages to prevent domain spoofing. Domain spoofing is when a spammer pretends to be you when sending phishing or malware emails.

When the receiving server gets an email from you, it checks the sender domain against the SPF record. If the SPF check fails, the receiving server could mark it as spam or reject it.

How Many SPF Records Can I Have Per Domain?

You can have 1 record max for each domain. Note that subdomains need their own record.

Is SPF Required for WordPress Emails?

Yes, it is. Email providers are starting to block emails that don’t have valid authentication (SPF, DMARC, and DKIM). Google is already blocking emails to Gmail addresses, and Yahoo is implementing similar rules.

By default, WordPress does not add authentication to emails, which is going to mean your emails are blocked. If you install an SMTP plugin such as WP Mail SMTP, and then create a matching SPF record, you won’t have this problem.

Is SPF Required for Every Mailer in WP Mail SMTP?

It’s required for most, but not all. SPF is required if you’re using:

  • SMTP.com
  • Brevo
  • Mailgun
  • Sendgrid
  • Google Workspace
  • Gmail, if used with your own custom domain
  • Outlook, if used with your own custom domain
  • Zoho Mail, if used with your own custom domain

In WP Mail SMTP, SPF is not required for:

  • Gmail addresses ending with gmail.com or googlemail.com (in other words, Google email addresses that are not associated with your own custom domain)
  • Hotmail or Microsoft email addresses ending with outlook.com
  • Zoho Mail addresses ending with zohomail.com.
  • Any senders set up in Postmark, SparkPost, or SendLayer.

If you don’t add SPF when it’s needed, WP Mail SMTP may show you a warning:

Action Needed: It doesn't look like the SPF record required by Google has been added to your domain. Please check out Google's SPF guide for details on how to add this record to your domain's DNS.

What Happens If I Have No SPF Records?

Some email providers don’t require SPF records, so it might not be a problem. For example, Postmark only needs you to set up DKIM.

If yours requires SPF, it’ll say that in its documentation.

If SPF is require and you haven’t set it up, mail servers will look for a DMARC record to figure out what to do with the email. Be warned that relying on DMARC is likely to result in your emails being filed in the junk email folder.

How Did I Wind Up With Multiple SPF Records?

Multiple SPF records are often added by accident. For example, you might have more than 1 because:

  • You switched mailer service: If you swap your email service provider (for example, you move from SMTP.com to Brevo), you might have forgotten to remove the first SPF record before adding a new one.
  • You’re using different services for different types of emails: For example, you might need to use Brevo to send WordPress emails with WP Mail SMTP, and another provider like SMTP.com to handle emails for your email marketing list.

If I Have Multiple SPF Records, Will My Test Email in WP Mail SMTP Still Work?

It might. Some customers have told us they still receive test emails in WP Mail SMTP even though they have multiple SPF records (or none at all). This might be because:

  • The receiving server automatically deals with the multiple SPF records behind the scenes, so you don’t notice there’s a problem.
  • Your mailer service doesn’t require SPF records anyway.

It’s better not to leave this to chance since it can cause problems later.

Does SPF Apply to My Subdomains?

No. Unlike DMARC, SPF doesn’t apply to all of your subdomains automatically. You need to create separate SPF records for subdomains.

What Does “Too Many DNS Lookups” Mean?

The include statement that we added is called a DNS lookup. SPF works by checking every domain in the rule. It will fail if you have more than 10.

You might see the error Too many lookups or Maximum hop count exceeded.

  • If you need to add more than 10 lookups to an SPF rule, you can add a subdomain and create a new SPF rule for that subdomain to get around this limit.
  • If you don’t have more than 10, it’s likely happening because every domain in your SPF record is being queried, and those domains have multiple include statements of their own. The result is that DNS is being queried too many times for the domains you entered. SPF flattening will solve this.

Additionally, check with your provider. They might provide a different SPF rule if you’re using more than 1 of their services.

What Does -all vs ~all Mean?

In an SPF record, -all means that any email not matching the domains will fail to be delivered. The ~all enforcement rule is slightly less strict and will look for further validation.

Some email providers will recommend the use of ?all (giving a neutral result).

If you need to combine statements with different enforcement rules, it’s safe to use ~all unless your email provider recommends a different approach.

It’s very important that you do not use +all in your SPF record. This will allow anyone on the internet to use your domain to send spam.

Do I Need a PTR Record?

Yes, you’ll also need a PTR record, but you likely won’t need to create it yourself. To find out more about it, check out our guide to PTR records.

What Does SPF PermError Mean?

The PermError occurs when an email service provider fails to verify your domain’s SPF record. This may happen if you’re using the incorrect syntax in your SPF record entry or if you have multiple SPF records.

To fix the PermError, check your syntax and combine your SPF records if you have more than one.

You may sometimes see a TempError too, which means there was a temporary issue. See our article on setting up Postmaster Tools so see what a TempError looks like.

Do I Need to Merge My DKIM Records?

No — DKIM records sometimes need to be split because some providers can’t handle super long entries in your DNS. If you see two, that’s likely intentional. To find out more, read our article on how to split your DKIM record.

Fix Your WordPress Emails Now

Next, Check Your DMARC Record

SPF is one of 3 email authentication methods that help improve deliverability and stop spam. Most email service providers use SPF along with DKIM and DMARC.

Now you have your SPF record set up, check out our easy guide on how to create a DMARC record. It includes a DMARC example that you can quickly copy and paste.

Ready to fix your emails? Get started today with the best WordPress SMTP plugin. WP Mail SMTP Pro gives you the option of 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPForms is funded, why it matters, and how you can support us.

Claire Broadley

Claire is the Content Manager for the WP Mail SMTP team. She has 13+ years' experience writing about WordPress and web hosting. Learn More

Try our Free WP Mail SMTP plugin

Use your favorite SMTP provider to reliably send your WordPress emails.

Please enable JavaScript in your browser to complete this form.

6 comments on “Multiple SPF Records: How to Merge Them (The EASY Way)

  1. I have been using Microsoft 365 (Outlook) and Mailerlite. Having two SenderID/SPF was causing issues. I solved the issue by following your sweet instructions. Kudos!

  2. I only have 2 domains in my SPF but Cloudflare gives the error “the number of lookups on the included domains above exceed the allowed limit of 10.”
    Nothing seems to work to eliminate this error except eliminating one of the domains… but I need both. What gives?

    1. Hi David. It sounds like SPF flattening might help here. I would recommend reaching out to support for a tailored response.

      If you have a WP Mail SMTP license, you have access to our trusted advisors in the support team, and you should get a response within 1 working day. Please submit a support ticket and share the same details that you posted here.

      If you’re using our free version, please head to the WP Mail SMTP WordPress.org support forum and open a new thread.

      We will update this article with some details on SMTP flattening as soon as we can.

      Thanks for reaching out!

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.