Merge the SPF records into one
Why it matters
A domain may publish only one SPF record, and with two or more receivers treat SPF as a permanent error, so legitimate mail can fail too. This usually happens when each mail service asks you to add its own record.
Staged change. Do this in stages and check each one before the next, so a mistake does not break your site or your mail.
The fix
- List every TXT record at the domain that starts with v=spf1 and copy the include, ip4, ip6, a and mx terms from each of them.
- Write one record: v=spf1, then every distinct term once, then a single all mechanism at the end (~all while testing, -all when sure). Do not repeat v=spf1 or put terms after all.
- Edit one existing record to hold the merged text and delete the others. Doing it in this order means there is never a moment without SPF.
- Afterwards check the merged record is within 10 DNS lookups (include, a, mx, ptr, exists and redirect each count); see the too-many-lookups fix if not.
dns
; Before: two records, one per provider (invalid) ; example.com. IN TXT "v=spf1 include:_spf.provider-one.example ~all" ; example.com. IN TXT "v=spf1 include:_spf.provider-two.example ~all" ; After: one record holding both example.com. IN TXT "v=spf1 include:_spf.provider-one.example include:_spf.provider-two.example ~all"
The examples use example.com. Replace it with your own domain.
Related
- Reported by the SPF record check
- Publish an SPF record
- Fix the syntax error in the SPF record
- Replace +all in the SPF record with ~all
- Narrow the very large address range in the SPF record
- Change ?all in the SPF record to ~all
- Choose the right SPF ending for this domain
- End the SPF record with ~all or -all
- Bring the SPF record under 10 DNS lookups
- Leave room under the SPF lookup limit
- Remove SPF terms that point at names that no longer exist
- Fix the SPF include that has no SPF record
- Break the loop in the SPF includes
- Replace the include that has several SPF records
- Replace the ptr mechanism in the SPF record
- Check the SPF terms that use macros
- Re-run the scan if part of the SPF record could not be read
Scan your domain to see whether this applies to you.