SPF PermError: too many DNS lookups means your SPF record needs more than 10 DNS lookups to evaluate, so receivers stop and treat SPF as failed. RFC 7208 section 4.6.4 says implementations "MUST limit the total number of those terms to 10", where the terms are include, a, mx, ptr, exists and redirect, counted through every nested include. The fix, in order: remove senders you no longer use, move some senders to their own subdomain, and only then consider flattening.
This post is part of our deliverability cluster; the pillar is the cold email deliverability checklist. A failing SPF record is one of the commonest reasons for Gmail 550 5.7.26 and Outlook 550 5.7.515 rejections.
Why it matters now
SPF used to be one signal among many. It now sits inside hard requirements. Google requires all senders to set up SPF or DKIM, and senders over 5,000 messages a day to personal Gmail accounts to have both, plus DMARC (Google sender guidelines). Microsoft requires SPF to pass for domains sending over 5,000 a day to Outlook.com (Microsoft's announcement). A permerror is not a pass, so if DKIM is not aligned either, DMARC fails.
How the error shows up
You rarely see the words "too many DNS lookups" in a bounce. More often you find it in the headers of a test message or in a DMARC aggregate report. In a Gmail test message (Show original), a failing record looks something like this (the exact wording varies by receiver):
Authentication-Results: mx.google.com;
spf=permerror (google.com: permanent error in processing during lookup of
hello@oakline-joinery.example: too many DNS lookups)
smtp.mailfrom=hello@oakline-joinery.example;
dkim=pass header.i=@oakline-joinery.example;
dmarc=pass (p=NONE) header.from=oakline-joinery.example
Here DMARC still passes because DKIM is aligned, which is why many domains run with a broken SPF record for months without noticing. If the DKIM signature is missing or signed by the provider's domain instead of yours, the same message fails DMARC, and a strict receiver may reject it.
Other places the error appears:
- DMARC aggregate reports show
spfresults ofpermerroragainst your own sending IPs. - Online SPF checkers report the total lookups and flag the record as over the limit.
- Some receivers add a
Received-SPF: PermErrorheader rather than anAuthentication-Resultsentry.
What counts toward the 10
| Term | Counts? | Notes |
|---|---|---|
include: | Yes, 1 each | Plus everything inside the included record |
a / a: | Yes, 1 each | |
mx / mx: | Yes, 1 each | And each MX host can trigger at most 10 address lookups, or mx itself returns permerror |
ptr | Yes, 1 | RFC 7208 section 5.5: "This mechanism SHOULD NOT be published" |
exists: | Yes, 1 each | |
redirect= | Yes, 1 | Plus everything in the target record |
ip4: / ip6: | No | No DNS query needed |
all | No | Always matches |
exp= | No | Only fetched to explain a failure |
The initial query for your own SPF TXT record does not count. Everything after it does.
The void lookup limit
RFC 7208 also defines "void lookups": queries that return no records or a nonexistent domain. Implementations "SHOULD limit 'void lookups' to two", and exceeding that is also permerror. Void lookups usually come from includes for services that have shut down or renamed their SPF host. They waste lookups and can fail the record on their own.
Two records is also permerror
Section 4.5: if more than one TXT record on the name starts with v=spf1, the result is permerror. People sometimes "fix" the lookup limit by adding a second record. Always merge into one.
A worked count
A fictional domain, oakline-joinery.example, has accumulated this record:
oakline-joinery.example. TXT "v=spf1 a mx include:_spf.mailhost.example include:spf.crm.example include:mail.invoicing.example include:servers.newsletter.example include:helpdesk.example include:oldforms.example ptr ~all"
Expanding each term (all includes are fictional, with their contents shown):
| Term | Direct lookups | What the included record contains | Nested lookups | Running total |
|---|---|---|---|---|
a | 1 | 0 | 1 | |
mx | 1 | 0 | 2 | |
include:_spf.mailhost.example | 1 | 3 includes, each with only ip4 | 3 | 6 |
include:spf.crm.example | 1 | ip4 ranges only | 0 | 7 |
include:mail.invoicing.example | 1 | 1 include with ip4 | 1 | 9 |
include:servers.newsletter.example | 1 | 1 include with ip4 | 1 | 11 |
include:helpdesk.example | 1 | ip4 only | 0 | 12 |
include:oldforms.example | 1 | Domain no longer exists (void) | 0 | 13 |
ptr | 1 | 0 | 14 |
Fourteen lookups. Receivers stop at the eleventh and return permerror. Note how the mail host's single include cost four lookups: the nested includes are invisible until you expand them, which is why "I only have seven includes" is not the same as seven lookups.
Fix order: remove, subdomain, flatten
1. Remove what does not send
Go through the record term by term and ask: does this send mail as this domain today?
oldforms.example: the form service was cancelled. Remove (saves 1, and removes a void lookup).ptr: never needed; the RFC says not to publish it. Remove (saves 1).a: the web server does not send mail. Remove (saves 1).mx: the inbound mail host is the same provider as_spf.mailhost.example, already covered. Remove (saves 1).helpdesk.example: the helpdesk sends replies from its own domain, not yours. Check its settings; if so, remove (saves 1).
New total: 9. Already under the limit, without touching anything that sends.
2. Move senders to subdomains
SPF is evaluated against the envelope sender domain (the return-path), not only the From address. Many newsletter and transactional tools let you send from a subdomain, with that subdomain's own SPF record:
oakline-joinery.example. TXT "v=spf1 include:_spf.mailhost.example include:spf.crm.example include:mail.invoicing.example ~all"
news.oakline-joinery.example. TXT "v=spf1 include:servers.newsletter.example ~all"
The main domain now needs 7 lookups and the subdomain 2. Each has headroom. This is also good practice for reputation: a newsletter complaint problem stays on news. rather than spreading to your one-to-one mail. The same thinking applies to cold outreach, which belongs on its own domain or subdomain; the cold email deliverability checklist covers that setup.
DMARC alignment still works with relaxed alignment, because news.oakline-joinery.example shares the organisational domain with a From of oakline-joinery.example.
3. Replace stable lookups with IP ranges
If one of your own servers sends from a fixed IP, an ip4:203.0.113.25 costs nothing where a:mail.oakline-joinery.example costs one. Do this only for addresses you control and that will not change without you knowing.
4. Flatten, as a last resort
Flattening replaces includes with the IP ranges they resolve to today. It works because ip4 and ip6 do not count. The risk is that providers change their IPs, sometimes without notice, and a flattened record silently goes stale. Mail from new IPs then fails SPF.
If you must flatten:
- Flatten only the includes that push you over, not the whole record.
- Use a tool or script that re-resolves and updates the record automatically.
- Keep DKIM aligned on every sender, so DMARC passes even if SPF breaks.
- Watch your DMARC aggregate reports for new SPF failures.
DMARC vendors often sell flattening as the first answer. For most small businesses, steps 1 and 2 solve the problem permanently with no ongoing cost.
Testing
- Read the record:
dig +short TXT oakline-joinery.example. Confirm there is exactly onev=spf1line. - Count the lookups: expand each include with
dig +short TXT <include-host>and count by the table above, or use any SPF checker that shows the expanded tree. - Check for void lookups: any include that returns nothing.
- Send a test to a Gmail account and an Outlook.com account. In the headers, look for
spf=passand the envelope domain (smtp.mailfrom) you expect. - Recheck after any new tool is added. Lookup creep is gradual; schedule a check whenever someone connects a new service.
Common mistakes when fixing it
- Adding a second SPF record for the new service instead of editing the first. That is a
permerrorof its own. - Using the old
SPFDNS record type. RFC 7208 publishes SPF only as a TXT record. - Switching to
+allor?allto make the error go away.+allauthorises every server on the internet to send as you. - Removing an include you still need because a checker called it "unused". Check which services actually send before deleting anything.
- Forgetting the subdomain. If a tool sends from
news.ormail., that name needs its own SPF record; the parent's record does not apply to it.
How Map Extract helps
The bulk email sender sends through your own SMTP mailboxes, so SPF is evaluated against your domain and your mail provider. Map Extract does not check or edit SPF records; fix the record with your DNS host using the steps above.
What it can do is limit the damage while you fix it. Bounces are read back by IMAP and a campaign pauses itself when bounces reach the threshold (5% by default), so an SPF failure that starts causing 5.7.x rejections stops the campaign rather than working through the whole list. You can also split campaigns across separate SMTP routes, for example a dedicated outreach subdomain, each with its own hourly and daily ceilings.
Related guides
- Cold email deliverability checklist
- Gmail and Yahoo sender rules for B2B cold email
- Outlook.com high-volume sender rules and 550 5.7.515
- DMARC 554 5.7.5 permanent error
Key takeaways
- The limit is 10 lookups across
include,a,mx,ptr,existsandredirect, including nested includes. ip4,ip6andallare free;ptrshould never be published.- More than two void lookups, or two SPF records, is also
permerror. - Remove unused senders first, then move tools to subdomains; flatten only if still over.
- Keep DKIM aligned so DMARC survives an SPF mistake.
Frequently asked questions
What causes SPF PermError too many DNS lookups?
Your SPF record, including every record it pulls in through include and redirect, needs more than 10 DNS lookups to evaluate. RFC 7208 caps the total at 10, and a receiver that hits the cap stops and returns permerror, which counts as an SPF failure for DMARC. It usually happens when several services have each been added with an include over the years.
Which SPF mechanisms count toward the 10 lookup limit?
The include, a, mx, ptr and exists mechanisms and the redirect modifier each count as one lookup, and lookups inside included records count too. The ip4, ip6 and all mechanisms do not count, and neither does the exp modifier. The mx and ptr mechanisms also have their own limit of 10 address lookups each.
Is SPF flattening safe?
It works, but it moves the maintenance to you. Flattening replaces include mechanisms with the IP addresses they currently resolve to, so the record needs fewer lookups. When a provider changes its sending IPs, a flattened record goes stale and mail from the new IPs fails SPF. Use it last, after removing unused senders, and only with automated updates.
What is the SPF void lookup limit?
A void lookup is a DNS query in SPF evaluation that returns no records or a nonexistent domain, for example an include pointing to a provider you no longer use. RFC 7208 says implementations should limit void lookups to two, and exceeding that also produces permerror. Removing includes for dead services fixes both problems at once.
Sources
Written by the Map Extract editorial team. Found an error? Email support@mapextract.uk and we will check and correct it. How we research guides: editorial policy.