Multiple SPF Records: Fix Permerror Without Breaking Mail
Fix multiple SPF records safely: distinguish TXT chunks from separate policies, verify the envelope domain, check lookup limits, and test each sender.
SPF requires at most one selected v=spf1 TXT record at the evaluated domain. Consolidate approved senders into one reviewed policy. Several strings inside one TXT record are joined without added spaces and are different from several SPF records.
Check the domain SPF actually evaluates
A second email provider asks you to add a TXT record. After the change, a receiver reports SPF permerror even though both providers’ setup screens look correct. One likely cause is that the same DNS name now publishes two SPF policies. Receivers do not combine them into a larger allowlist.
First identify the SPF identity in a trusted receiver’s Authentication-Results header. For a normal message with a non-empty reverse path, SPF evaluates the envelope sender domain, commonly shown as smtp.mailfrom. This can differ from the visible From address and can be a provider-managed bounce subdomain. For a null reverse path, the HELO identity is used. Inspect the identity that failed rather than editing the root domain automatically.
Use the full message headers from a receiver you control or trust. A sender can insert its own Authentication-Results header, so an arbitrary occurrence is not evidence of your receiving system’s decision. Record the identity, result and timestamp. If the failure is for bounce.example.net, a second policy at example.net is a separate finding, not proof that it caused this message’s error.
Source: RFC 7208: SPF identities, record selection, strings and DNS lookup limits ↗
Retrieve every TXT record at that exact name
With dig installed, replace the example name with the observed SPF identity. Keep the trailing dot so it is treated as an absolute DNS name. Retain the full answer rather than searching only for include terms. Check the response status too: a timeout or SERVFAIL is not evidence that no SPF policy exists.
For each TXT resource record, join its character-strings without inserting separators, then inspect the version prefix. Two selected v=spf1 records at the same name cause SPF permerror. Other TXT records, such as a site verification token, can coexist there and are not additional SPF policies. A record beginning v=spf10 is not selected as SPF version 1.
If you suspect a cached answer, compare the recursive answer with the delegated authoritative servers for the containing zone. Discover the correct zone and its delegation first; a subdomain can be delegated separately. Query each applicable authority directly with recursion disabled and inspect the authoritative-answer flag and record contents. Do not assume the nameservers shown in an inactive DNS dashboard serve the live zone.
# Replace with the domain shown in the trusted SPF result:
dig bounce.example.net. TXT +noall +comments +answer
# Replace the server with an actual delegated authority:
dig @ns1.example.net. bounce.example.net. TXT +norecurse +noall +comments +answerSource: RFC 7208: SPF identities, record selection, strings and DNS lookup limits ↗
Distinguish two records from two strings
The first two lines below are two resource records at the same owner name, so both would be selected. The later example is one record containing two character-strings. The strings are concatenated as they are; DNS does not supply a space between them. The trailing space inside the first string keeps the SPF mechanisms separate.
This distinction matters when a DNS interface splits a long value into quoted chunks. Several chunks in one TXT record are valid, and each character-string has a 255-octet maximum. Adding another TXT record to get around that limit creates a different situation. Use the provider’s documented input format and check the published answer after saving. Some interfaces add quoting automatically, so pasting presentation syntax into a text field without checking can produce unintended content.
These use reserved documentation addresses and demonstrate record structure only. They are not a mail configuration to copy to your own domain. The unrelated verification TXT record belongs in the zone if it is still needed.
; Two SPF policies: invalid selection at example.net.
example.net. 300 IN TXT "v=spf1 ip4:192.0.2.10 -all"
example.net. 300 IN TXT "v=spf1 ip4:198.51.100.20 -all"
; Instead, one record with two strings:
example.net. 300 IN TXT "v=spf1 ip4:192.0.2.10 " "ip4:198.51.100.20 -all"
example.net. 300 IN TXT "site-verification=keep-this-token"Source: RFC 7208: SPF identities, record selection, strings and DNS lookup limits ↗
Build one policy from the real sender inventory
Before deleting anything, export the existing TXT values and identify every service that sends using this envelope domain. Include ordinary mail, help-desk messages, invoices and marketing systems. Some services send through their own return-path domain, in which case your root SPF policy may not be the relevant control. Remove retired services only after confirming ownership and current use.
For simple policies, combine the required authorization mechanisms under one v=spf1 prefix and one intended terminal all mechanism. Preserve the deliberate qualifier: -all means fail for unmatched senders, while ~all means softfail. Do not silently choose the weaker result to make a checker green. Do not append a new include after all; an all mechanism matches every remaining sender, so later mechanisms cannot authorize anything.
More complex policies need review rather than text concatenation. An include evaluates another domain’s SPF policy and matches when that nested check passes. Copying the nested policy’s -all into the middle of your policy changes the meaning. A redirect modifier delegates evaluation when no mechanism matches and is ignored when all is present; blindly combining it with another policy can defeat the intended delegation.
The example below represents two approved providers whose documented SPF include names have already been verified. Replace them with genuine values only after checking the providers’ current instructions. Publish it as the single SPF record at the affected identity, preserving unrelated TXT records and separate DKIM or DMARC records.
; Illustrative provider names; not real provider configuration:
example.net. 300 IN TXT "v=spf1 include:_spf.mail-a.example include:_spf.mail-b.example -all"Source: RFC 7208: SPF identities, record selection, strings and DNS lookup limits ↗
A single record can still produce permerror
After consolidating the policies, check the DNS lookup budget. SPF evaluation limits the number of evaluated DNS-querying terms, including include, a, mx, ptr, exists and redirect, to ten. The accounting includes nested evaluation. Two include terms at the top level do not imply only two terms across the whole policy. ip4, ip6 and all do not require these DNS lookups.
Use an SPF evaluator that reports the evaluated identity, source IP, result and lookup trace. Test each active sender path. A simple count of include strings in the published root record cannot establish compliance because includes can contain other includes and evaluation can end on different branches. A DNS failure during evaluation also needs its own diagnosis; do not interpret every non-pass result as a duplicate record.
Avoid replacing provider includes with a one-time snapshot of their IP addresses unless you deliberately own the maintenance process and understand the provider’s support requirements. IP ranges can change. A flattened policy that passes today can stop authorizing legitimate mail later. If the policy is too complex, reduce obsolete senders or use supported dedicated return-path subdomains with their own policies instead.
Source: RFC 7208: SPF identities, record selection, strings and DNS lookup limits ↗
Reproduce the record-versus-string distinction locally
This Python example models already-decoded TXT records. Each inner list represents the ordered character-strings of one resource record. It joins those strings and counts version-1 candidates. The fixtures show two policies, one chunked policy, a broken missing-space join, and a non-matching version.
The output is a selection summary, not an SPF validator. A single candidate can have invalid syntax, exceed lookup limits or fail to authorize an address. The missing-space fixture intentionally shows that selection alone cannot prove a policy is usable. When reading actual DNS with a library, preserve resource-record boundaries and chunk order; do not join every TXT record into one value.
def selection_summary(records):
values = ["".join(chunks) for chunks in records]
selected = [
value for value in values
if value[:6].lower() == "v=spf1"
and (len(value) == 6 or value[6] == " ")
]
count = len(selected)
return (
"none" if count == 0 else
"one candidate; validate next" if count == 1 else
"permerror: multiple SPF records"
)
fixtures = [
(
[["v=spf1 ip4:192.0.2.10 -all"],
["v=spf1 ip4:198.51.100.20 -all"]],
"permerror: multiple SPF records",
),
(
[["v=spf1 ip4:192.0.2.10 ", "ip4:198.51.100.20 -all"],
["site-verification=keep-this-token"]],
"one candidate; validate next",
),
(
[["v=spf1 ip4:192.0.2.10", "ip4:198.51.100.20 -all"]],
"one candidate; validate next", # Still needs syntax validation.
),
(
[["v=spf10 ip4:192.0.2.10 -all"]],
"none",
),
]
for records, expected in fixtures:
result = selection_summary(records)
assert result == expected
print(result)Source: RFC 7208: SPF identities, record selection, strings and DNS lookup limits ↗
Verify DNS and then send through each provider
After saving the change, query the actual authoritative servers and confirm there is one selected SPF record. Then query the recursive resolver used in your test path. A resolver may retain the previous TXT RRset until its TTL expires; reducing a TTL now does not shorten the lifetime of an answer it already cached. DNS providers can also take time to update all authoritative servers, so compare their answers instead of relying on a generic propagation countdown.
Send a new message through each approved provider and inspect the trusted receiver’s result for the expected smtp.mailfrom identity. Preserve the before-and-after headers and the DNS answer. Passing a website checker for the root domain is insufficient if production messages use a different envelope domain. Passing SPF is also not a delivery guarantee: content, reputation and other authentication checks remain relevant.
Finally, distinguish SPF pass from DMARC alignment. A message can pass SPF for a provider’s domain without that domain aligning with the visible From domain. DMARC can pass through aligned SPF or aligned DKIM. If SPF now passes but DMARC still fails, investigate alignment and DKIM evidence rather than adding a second SPF record. Close the change when the published policy is singular, each legitimate sender has been tested, and the original permerror is gone.
Source: RFC 7489: DMARC identifier alignment and authentication ↗
Your next steps
- Check the SPF identity reported by a trusted receiver before editing DNS.
- Preserve TXT record boundaries and unrelated verification records while consolidating sender authorization.
- Verify the authoritative answer, lookup behavior and a new message from every active provider.
Sources & official resources
Linked resources checked on 2026-11-11. Technical behavior and provider guidance can change; check the documentation for the version you use.
About this guide and its recommendations
Published by Prep With Proof with AI-assisted drafting. Study routines and examples are editorial suggestions, not official exam instructions or claims of a learner's personal results. Cited provider facts are linked; ownership of recommended Prep With Proof products is disclosed. No competitor endorsement or guaranteed certification outcome is implied.
Suggest a correction →