Linux Systems Engineer
- Oct 18, 2019
- Reaction score
- Novosibirsk, Russia
v=spf1 ip4:6126.96.36.1999 include:amazonses.com include:_spf.yandex.net ~all
Do you need to fix multiple SPF records on your domain?
SPF records are TXT type records starting with v=spf1. Multiple SPF records cause your emails to be rejected or filed as spam.
In this article, we’ll explain:
Can You Have More than 1 SPF Record?No, you can’t have more than 1 SPF record. If you do have two separate SPF TXT record entries, your emails will fail SPF authentication and return a PermError.
If you have multiple SPF records, the simple fix is to merge these entries into a single record.
According to Alexa, one in 6 domains with an SPF record is using the wrong format, with multiple TXT records. So it’s definitely worth checking to make sure you don’t have any extra or unwanted SPF records.
How to Fix Multiple SPF RecordsIf you have multiple SPF records, here’s the good news: this is an easy problem to fix, and it only takes a few minutes to combine your SPF records.
To begin, we’ll check your DNS records with a free online tool.
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.
Check For Multiple SPF RecordsSometimes multiple SPF records are hard to spot. In fact, you might not even know you need to combine SPF records because your receiving email host might automatically ignore them. But it’s still not a good idea to have more than one.
We can use 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.
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.
As you can see, there are 2 lines starting with v=spf1, which is a mistake. A receiving mail server won’t know which rule to follow, so it will simply ignore both of these TXT records.
To solve the issue with your SPF records, we’re going to edit your domain’s DNS records and combine both rules, thereby eliminating multiple TXT records.
DNS records are typically held by:
- Your domain registrar
- 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 one.
Edit SPF in CloudflareWe’ll show you how to fix multiple SPF records using Cloudflare first.
To start, log in and select the domain you want to edit.
You’ll see your entire DNS listed. Look for the TXT records to find the duplicates.
If your DNS doesn’t look like this, let’s try another way of finding the right records.
Edit SPF Records in BluehostIf your domain is hosted by Bluehost, log in to your control panel to start.
From the left-hand menu, click on Domains.
From the list, click the Manage dropdown next to the domain you need to edit.
From the menu that pops out, click on DNS.
Now scroll down until you find your TXT records. You’ll see the SPF records in this section.
Again, your DNS may look different, but this should get you to the right place.
How to Include Multiple SPF RecordsNow we’re going to use the correct syntax to merge multiple SPF records. This will allow you to use multiple IPs or domains in 1 line.
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.
Copy the existing rule to your clipboard. You might want to paste it into a text document so you can grab it again in a second.
Now delete that record from your DNS.
In Bluehost, you can delete the record using the icon to the right with the 3 dots.
We’re going to switch back to Cloudflare for the rest of these steps.
Now click Edit next to the remaining SPF record.
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 the record with v=spf1 (don’t use this again in the rule—it must only appear at the start)
- Allowed domains: Add an include for each domain
- Enforcement rule: End the record with one ~allstatement (again, only use this at the end)
v=spf1 include:zoho.eu include:mailgun.org ~all
Go ahead and edit your SPF rule so that it combines both of the domains.
As long as you only have 1 declaration and 1 enforcement rule, you can include more domains if you need to, as long as they’re in a single string.
Keep in mind that there are limits for SPF records:
- The statement can have a maximum of 10 domain lookups (e.g. include)
- The statement must be less than 255 characters long.
Test Your Merged SPF RecordsIt 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.
And that’s it! You successfully fixed the problem of multiple SPF records on your domain.
Frequently Asked Questions on SPF RecordsLet’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.
Is SPF Required for Every Mailer in WP Mail SMTP?SPF is required for many mailers, including:
- Outlook, if used with your own custom domain
- Zoho Mail, if used with your own custom domain
- Gmail addresses ending with gmail.com or googlemail.com (in other words, Google email addresses that are not controlled by a G-Suite subscription or a 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.
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 does, and you haven’t set one up, mail servers will look for a DMARC record to figure out what to do with the email. This 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 Sendinblue), 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 Sendinblue 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?Sometimes you’ll still receive test emails in WP Mail SMTP even though you have multiple SPF records (or none at all). This might be because:
- The receiving server is automatically dealing with the multiple SPF records behind the scenes, so you don’t notice a problem.
- Your mailer service doesn’t require SPF records, so it’s already ignoring them.
Does SPF Apply to My Subdomains?No. Unlike DMARC, SPF doesn’t apply to subdomains. You need to create separate SPF records for subdomains at your host.
What Does “Too Many DNS Lookups” Mean?SPF works by checking every domain in the rule. This is called a DNS lookup. So if your SPF record has too many domains in it, 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.
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, you can use ~all unless your email provider recommends a different approach.
It’s very important that you do not use +all because 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 this guide: What Is a DNS PTR Record?
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 make sure to combine your SPF records if you have more than one of these.
Next, Check Your DMARC RecordSPF 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 Elite includes full White Glove Setup and offers a 14-day money-back guarantee.