SPF
SPF PermError: "Too Many DNS Lookups" and Other Causes
SPF returns permerror when a receiver cannot interpret your record. The usual cause is more than 10 DNS-querying terms, but extra void lookups, two SPF records, a syntax error or an include with no SPF record do the same. This guide shows how lookups are counted and gives corrected records.
By MailConfig.pro TeamPublished 8 min read

On this page
An SPF permerror means the receiving server could not correctly interpret your SPF record, so it cannot give an SPF result for the message (RFC 7208, section 2.6.7). The most common cause is a record that makes more than 10 DNS-querying terms during evaluation; the other causes are more than two void lookups, more than one SPF record on the same name, a syntax error, and an include or redirect that points to a domain with no SPF record. To fix it, find which of these applies, then remove unused senders, replace stable a and mx terms with ip4/ip6, or give a sender its own subdomain.
What a PermError does to your mail
"Permanent error" means retrying will not help: the published record itself is the problem and, in the words of the RFC, it "definitely requires DNS operator intervention" (section 2.6.7). It is different from a temperror, which is a transient DNS failure that a later retry may clear.
What a receiver does with a permerror is its own choice. RFC 7208 appendix G.3 lists rejecting the message or delivering it with an annotation as options, and notes that rejection is the one way to draw the sender's attention to the problem. Do not assume that mail will be tolerated.
For DMARC, a permerror means there is no SPF-authenticated identifier for the message. The message can still pass DMARC if a DKIM signature aligns with the From domain, but a domain that relies on SPF alone will fail (see how DMARC alignment works).
Cause 1: more than 10 DNS lookups
Section 4.6.4 of RFC 7208 says implementations must limit the total number of DNS-querying terms to 10 during SPF evaluation, and must return permerror if the limit is exceeded.
Counted (each use is one lookup): the include, a, mx, ptr and exists mechanisms, and the redirect modifier.
Not counted: the all, ip4 and ip6 mechanisms and the exp modifier.
The limit covers the whole evaluation, including the records you reach through include and redirect. An included record with its own includes spends lookups from your budget, and your record cannot see that from the outside. This is why a short-looking record with three include: terms can fail.
A worked count
Assume example.com publishes this record:
example.comv=spf1 include:_spf.example.net include:mail.example.org include:bulk.example.com a mx ~alland the included domains publish these (illustrative records, not real services):
_spf.example.netv=spf1 include:s1.example.net include:s2.example.net include:s3.example.net -allmail.example.orgv=spf1 a mx include:relay.example.org -allThe s1.example.net, s2.example.net, s3.example.net, relay.example.org and bulk.example.com records contain only ip4 terms and all. The tally:
example.com: threeincludeterms,aandmx, which is 5 lookups._spf.example.net: threeincludeterms, which is 3 more.mail.example.org:a,mxandinclude, which is 3 more.
That is 11 in total.
Eleven exceeds the limit of 10. Evaluation stops at the first mechanism that matches, so the error can appear only for mail that gets far enough into the record to cross the limit. Do not treat that as safety: a sender that happens to match late will hit it. The SPF lookup counter expands the whole include tree, which shows the worst case.
Two more limits sit inside the 10:
- An
mxmechanism must not trigger more than 10 address lookups (A or AAAA) for the MX hosts it finds; more than that producespermerrorfor the mechanism. - For
ptr, address lookups beyond the first 10 are ignored instead. The RFC saysptrshould not be published at all (section 5.5).
How to get under the limit
- Remove senders you no longer use. Old
include:terms for retired marketing tools are common. Check which sources appear in your DMARC aggregate reports before deleting anything; reading those reports for unknown senders is covered separately. - Replace
aandmxwith addresses if they are stable. RFC 7208 section 10.1.1 compares anmx-based record with the equivalentip4list and calls theip4form the best one, because it needs no DNS queries. The price is that you must update the record when the addresses change. - Drop
ptr. It is slow, unreliable and discouraged by the standard. - Give a high-lookup sender its own subdomain. If a service needs several includes, have it send with an envelope (
MAIL FROM) domain such asbounces.example.comand publish the service's includes only there. That subdomain is evaluated on its own budget. Under relaxed alignment,bounces.example.comstill aligns with aFromaddress atexample.comfor DMARC (RFC 9989, section 4.4). - Let the sender use its own return-path domain, and rely on DKIM. SPF then passes for the service's domain, which does not align with yours. DMARC can still pass through an aligned DKIM signature.
- Copy a provider's IP ranges into
ip4/ip6terms only with care. It removes lookups but you now own the maintenance. If the provider changes its ranges, your record is silently wrong and mail from the new addresses fails SPF. Do this only when you will watch for changes.
Corrected example, using the same illustrative providers: the a and mx terms are replaced by the address of your own mail server (192.0.2.10, from the documentation range), which brings the total from 11 to 9.
example.comv=spf1 include:_spf.example.net include:mail.example.org include:bulk.example.com ip4:192.0.2.10 ~allCount: 3 includes in this record, 3 inside _spf.example.net, 3 inside mail.example.org, and the ip4 term costs nothing. That leaves one lookup of headroom, which is thin; any change in a provider's own record can use it. Moving one sender to a subdomain gives more.
Cause 2: too many void lookups
A void lookup is a DNS query for a term that returns either no data (response code 0 with no answers) or NXDOMAIN. RFC 7208 section 4.6.4 says implementations should limit void lookups to two, and section 11.1 describes aborting with permerror as soon as more than two have been encountered. It is a "should", and an implementation may make the limit configurable, but a default of two is recommended, so treat two as the working limit.
Typical causes are a:, mx: or exists: terms that point at hostnames you deleted, or a record copied from another domain. Delete terms that no longer resolve.
Cause 3: more than one SPF record
A domain name must not have multiple records that would cause an SPF check to select more than one (RFC 7208, section 3.2). A receiver keeps the TXT records that start with exactly v=spf1 (so v=spf10 is discarded), and if more than one remains, the result is permerror (section 4.5).
This usually happens when someone adds a new service by publishing a second record instead of editing the first:
example.comv=spf1 include:_spf.example.net -allexample.comv=spf1 include:mail.example.org -allMerge them into one record. This also means a single -all at the end:
example.comv=spf1 include:_spf.example.net include:mail.example.org -allOther TXT records on the same name, such as a site verification token, are not a problem. Only records that begin with v=spf1 count.
Cause 4: syntax errors
The receiver validates the syntax of the whole record before evaluating it. A syntax error anywhere returns permerror immediately, even if the sender would have matched an earlier term (RFC 7208, section 4.6). Typical errors:
- A term that is not a defined mechanism and not a
name=valuemodifier, such asipv4:192.0.2.1instead ofip4:192.0.2.1. Unknown modifiers are ignored, but unknown mechanisms do not fit the grammar. - An invalid address, such as
ip4:192.0.2.300, where each octet must be 0 to 255. - An
includewithout a colon, such asinclude example.net. - A
%in a macro string that is not followed by{,%,-or_(section 7.3). - Characters introduced by copy and paste, such as curly quotes or stray line breaks.
Also remember what is not an error but still surprising: mechanisms written after all are ignored (section 5.1), and a redirect= modifier is ignored when the record contains all.
Cause 5: an include or redirect with no SPF record
If an include target has no SPF record, or its own evaluation returns permerror, the include returns permerror (RFC 7208, section 5.2). A redirect to a domain with no SPF record also gives permerror rather than none (section 6.1). The usual causes are a typo in the domain, a provider that retired its record, or an included domain that itself has two records.
Related: record size
Long records are not a permerror cause by themselves. A single DNS character-string is limited to 255 octets, so long TXT records are published as several strings, which receivers join without adding spaces (RFC 7208, section 3.3). Your DNS provider's interface usually does the splitting. Section 3.4 also advises keeping the SPF answer small enough to fit a 512-octet DNS response, because larger answers could be dropped by some verifiers. That is a second reason to trim a bloated record.
How to check your record
The SPF checker looks up the record and reviews the recursive lookup budget. For a quick look from a terminal:
dig +short TXT example.com
If more than one line starts with "v=spf1, you have Cause 3. Then follow each include: with the same command and count terms by hand, or use the lookup counter. After you publish a change, wait for the old record's TTL to pass before concluding the fix did not work.
When you need a clean starting point, the SPF generator assembles a basic record from include domains and your chosen all mechanism.
Frequently asked questions
Is the limit 10 includes?
No. The limit is 10 DNS-querying terms in total: include, a, mx, ptr, exists and redirect. Terms inside included records count too, so one include can use several lookups.
Do ip4 and ip6 mechanisms count toward the limit?
No. The all, ip4 and ip6 mechanisms and the exp modifier do not cause DNS queries during evaluation, so they are not counted (RFC 7208, section 4.6.4).
Does the limit apply to each domain separately?
It applies to one SPF evaluation. Each evaluation starts from the domain being checked, so a record on a different domain, such as a bounce subdomain, has its own budget.
References
- RFC 7208: Sender Policy Framework (SPF), section 4.6.4 (DNS lookup limits) and section 4.6 (record evaluation)
- RFC 7208, section 4.5 and section 3.2 (selecting records, multiple records)
- RFC 7208, sections 3.3 and 3.4 (record strings and size), 5.1 (all), 5.2 (include), 6.1 (redirect) and 7.3 (macros)
- RFC 7208, section 5.5 (ptr, do not use), section 10.1.1 (DNS resource considerations) and section 11.1 (void lookups)
- RFC 7208, section 2.6.7 (permerror) and appendix G.3 (policy for permerror)
- RFC 9989: DMARC, section 4.4.2 (SPF-authenticated identifiers) and section 4.4 (relaxed alignment)
spfpermerrordns lookupstroubleshooting
Related articles
DMARC
What Is DMARC? How Email Authentication Fits Together
DMARC is a DNS record that ties SPF and DKIM to the domain in the visible From address, states what receivers should do with mail that fails, and requests reports. This guide covers alignment, the record syntax, policies, reporting and what happens when a domain has no record.
· 10 min read
DMARC
DMARC p=none vs quarantine vs reject: Rolling Out Enforcement
p=none asks for no change in handling and gives you reports, p=quarantine asks receivers to treat failing mail as suspicious, and p=reject asks them to refuse it. This guide covers when each fits, a staged rollout, what happened to pct, and the risks from forwarding and mailing lists.
· 9 min read
DMARC
How to Identify Unknown Senders in DMARC Aggregate Reports
A step-by-step method for the unfamiliar IP addresses in your DMARC aggregate reports: which XML fields matter, how to map an IP to a service with PTR, RDAP and ASN, how to separate legitimate senders from spoofing, and how to fix SPF and DKIM alignment.
· 7 min read


