Skip to content

SPF PermError: too many DNS lookups

Your SPF record needs more than 10 DNS lookups, so receivers return permerror; this is what counts toward the limit and how to get back under it.

Last updated:

What the checker reports

Critical spf.lookup_limit_exceeded

SPF needs more than 10 DNS lookups; the limit is 10

Receivers stop after 10 terms that query DNS (include, a, mx, ptr, exists and redirect, counted through every included record) and return permerror. Any server not matched before that point fails SPF.

How to fix: Remove includes for services you no longer use, replace a and mx terms with the ip4 and ip6 ranges they stand for, and move services with large records to a subdomain with its own SPF record. Aim for 8 lookups or fewer so a provider change doesn't push you over.

What this error means #

A receiving mail server checks SPF by following your record and every record it includes. RFC 7208 caps that walk at 10 terms that make a DNS query. Your record needs more than 10, so the receiver stops and reports permerror, a permanent error. The standard says a permerror “definitely requires DNS operator intervention”, so nothing fixes it until someone edits your DNS.

These terms cost one lookup each:

  • include, a, mx, ptr and exists
  • the redirect modifier

all, ip4 and ip6 cost nothing, and neither does exp while the record is being evaluated.

The count is one total for the whole walk, not one per record. RFC 7208 §4.1 says the limit “must be tracked as a single global limit for all evaluations, not just for a single instance of a recursive evaluation”. An include therefore costs one lookup for itself plus every counted term inside the record it points to. You can’t see that second part from your own record, and the included records belong to the services you include, so a record that passed last month can fail today without any edit on your side.

Two smaller caps sit on top. For mx, RFC 7208 §4.6.4 says:

the evaluation of each “MX” record MUST NOT result in querying more than 10 address records … If this limit is exceeded, the “mx” mechanism MUST produce a “permerror” result.

In plain words, each MX host needs its own address lookup, so an mx term whose domain has more than 10 MX hosts gets permerror (§5.4 calls this the MX lookup limit). For ptr, PTR names past the first 10 are ignored, and §5.5 says the mechanism SHOULD NOT be published at all.

Mail from a server matched by a term on the left of your record never reaches the terms after it, so a test from your main server can pass while mail from your other services fails.

How receivers treat it #

Standard: RFC 7208 §4.6.4

SPF implementations MUST limit the total number of those terms to 10 during SPF evaluation, to avoid unreasonable load on the DNS. If this limit is exceeded, the implementation MUST return “permerror”.

What a receiver does with a permerror is its own local policy (RFC 7208 §4.2). If it rejects the message during the SMTP conversation, §8.7 says it should use reply code 550 with, if supported, the enhanced status code 5.5.2.

DMARC reads SPF in a narrower way. RFC 9989, which replaced RFC 7489 in May 2026, relies solely on SPF validation of the MAIL FROM identity (§4.4.2), and a domain only becomes an SPF-authenticated identifier when SPF returns a pass (§4.10.2). A permerror isn’t a pass, so DMARC has nothing to align, and softfail and fail give it nothing either. The message can still pass DMARC through a DKIM signature whose domain aligns with your From domain (§5.3.5).

Broken and fixed record #

too-many-lookups.zone
example.com.           TXT  "v=spf1 a mx include:spf.mailer.example include:spf.helpdesk.example include:spf.crm.example ~all"
spf.mailer.example.    TXT  "v=spf1 include:a.mailer.example include:b.mailer.example include:c.mailer.example -all"
spf.helpdesk.example.  TXT  "v=spf1 include:a.helpdesk.example include:b.helpdesk.example -all"
spf.crm.example.       TXT  "v=spf1 include:a.crm.example include:b.crm.example -all"

The first record costs 12 lookups, assuming the leaf records such as a.mailer.example hold only ip4 terms. Your own record has 5 (a, mx and three includes), and the three services add 3, 2 and 2 behind them. In the fixed version below, your own a and mx terms, which both resolved to 192.0.2.10, became one ip4 term. The help desk tool, which cost 3 lookups in the main record, moved to its own subdomain, where its record is checked on its own. The main record now costs 7.

fewer-lookups.zone
example.com.           TXT  "v=spf1 ip4:192.0.2.10 include:spf.mailer.example include:spf.crm.example ~all"
support.example.com.   TXT  "v=spf1 include:spf.helpdesk.example ~all"

The subdomain only helps if the help desk tool uses support.example.com as its MAIL FROM (bounce) domain, because that’s the identity receivers check (RFC 7208 §2.4). DMARC’s default relaxed SPF alignment (aspf=r, RFC 9989 §4.7) accepts a domain with the same Organizational Domain as your From domain, which includes a subdomain of it (§4.10.2).

How to fix it #

Some tools suggest flattening: copying the addresses a provider publishes into your own ip4 and ip6 terms, which cost nothing. It’s a trade-off. The record only matches the addresses you copied, so when the provider changes its servers, your copy goes stale and that service’s mail fails SPF until someone updates it. That stale copy turns into an SPF fail, and RFC 9989 §7.1 warns that a hard fail from -all can lead to rejection early in the SMTP transaction, before DMARC runs, for messages that “might otherwise pass DMARC due to an aligned DKIM-Authenticated Identifier”. The older DMARC standard, RFC 7489 §10.1, says the same about early rejection. RFC 7208 §3.4 also asks for records small enough that the DNS answer fits in 512 octets, and a flattened record gets long fast.

  1. Run the SPF Record Checker on your domain to see the lookup count and what each include adds.
  2. Remove includes for services you’ve stopped using. Ask around before deleting one nobody recognizes, because mail from a forgotten tool will start failing.
  3. Replace a and mx terms with the ip4 and ip6 addresses they stand for, if those addresses rarely change.
  4. Move a service with a large record to a subdomain with its own SPF record, as above.
  5. Publish the updated record, then run the SPF Record Checker again. Aim for 8 lookups or fewer, so a change at a provider doesn’t push you back over 10.

Check your domain

Records look right? Check the list next.

Kavik.email checks every address on your list, so what you send reaches real inboxes.