Email errors
Multiple SPF Records: Why It Fails and How to Merge Them
Multiple SPF records on one DNS name cause SPF permerror. Merge them into a single v=spf1 record with multiple includes, step by step.
What this means
Multiple SPF records means one DNS name publishes two or more TXT records that begin with v=spf1. SPF is the DNS record that lists which servers may send mail for a domain. RFC 7208 forbids this and requires the result permerror, meaning the published records could not be correctly interpreted. To authorize another sender, add it to the record you already have.
Every message checked against that name gets permerror. In message headers, look for spf=permerror.
Correctly listed senders get permerror too, and each receiver decides whether to reject or deliver. DMARC, the policy check built on SPF and DKIM signatures, can pass only through a valid DKIM signature aligned with the From domain.
Why it happens
A second record appears when someone creates a new v=spf1 entry instead of editing the existing one, for example when adding a mail service or splitting a long record. Other TXT records do not count, because receivers discard anything not beginning with v=spf1.
If only some sources get permerror, check the include targets. A target with duplicates returns permerror once the check reaches it. Too many DNS lookups can do the same.
How to fix it
-
Find the name that was checked. In the headers of an affected message, read
smtp.mailfrom=besidespf=permerror. That envelope sender, the address used during delivery, can differ from the From address. If a vendor owns it, ask the vendor to fix it. -
List every
v=spf1record on that name. Runnslookup -type=TXT example.com 1.1.1.1to see them all. The SPF checker counts them but shows just one. If you find only one, repeat for eachincludetarget and report duplicates to its owner. -
Collect every source. Note each term between
v=spf1andallin all the records. Caution: a source you leave out will not pass SPF after the merge, so compare your list with recent DMARC aggregate reports first. -
Build one record. Use one
v=spf1, every source once and oneallat the end. Mechanisms afterallare never tested, so two records pasted together lose the second half. Change anyredirect=toinclude:, becauseallcancels it. List only services you use. Google documents this form for Google Workspace plus Microsoft 365:TXTv=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all
-
Choose the ending. Google recommends
~all. Microsoft recommends-allfor Microsoft 365 domains with DKIM and DMARC. Start with~all, even if the old records used-all. Caution: receivers may reject unlisted sources under-all, so move to it only after reports show every source passing. -
Publish in this order. At your DNS host, edit one record to hold the merged value, then delete the others. Caution: delete a record only after its sources are in the merged one.
How to add multiple SPF records for different services
New senders go in the same record, and an SPF record with multiple includes is valid. Give each service its own include: before all, with a space between terms. Use the value from the service's documentation. An -all inside an included record does not end the check.
Each include uses at least one of the 10 DNS lookups SPF allows, and includes nested inside it count too. Past 10, the result is permerror again, so read the count in the SPF checker. If you run out, Microsoft suggests moving non-Microsoft services to a subdomain with its own SPF record and lookup budget. Caution: keep the service's include in the main record until a test from the subdomain shows spf=pass.
Confirm the fix
- Google says SPF fixes can take 24 to 48 hours to take effect globally.
- Run the checker again. You want exactly one
v=spf1record on the name and 10 lookups or fewer. - Send a test from each service to a mailbox you control. Each must show
spf=passin theAuthentication-Resultsheader. - Read the next DMARC aggregate reports. Where they list an SPF
resultfor those sources, it should change frompermerrortopass.