opyeb spfdkim

spfdkim · SPF limits

The SPF ten-lookup limit and void lookups

However correct an SPF record looks, more than ten DNS lookups make receivers return permerror. Know what counts and how to reduce it.

Why ten

SPF evaluation needs several DNS queries per message. A hostile record could chain records indefinitely, so RFC 7208 caps the DNS lookups in a single evaluation at ten. Past that the result becomes permerror, which most receivers treat as a failure.

What counts

TermLookupsNote
includeoneLookups inside the included record are added too.
aoneOne lookup even with an explicit domain.
mxoneOne lookup regardless of how many MX hosts exist.
ptroneDiscouraged, but still counted.
existsoneMacros can generate many names.
redirectoneEvaluated only when no all is present.
ip4, ip6, allnoneNo DNS query.
expoutside the limitCauses a separate lookup.

A recursive example

Suppose the top record uses two includes plus a and mx: four lookups. If the first included record uses one include and ip4, that adds one. If the second uses a and mx, that adds two. The total is seven. Adding an exists term makes eight.

v=spf1 include:_spf.example.com include:mail.example.com a mx exists:%{i}.example.com -all

The count is only accurate if the included records are actually read. A tool that performs no DNS query must be given those records; spfdkim sums them when you add one `name: record` line per included domain in the sub-record field.

The two-void-lookup rule

A void lookup ends with an empty answer or NXDOMAIN. Because a, mx, ptr and exists look names up, a missing answer makes them void. RFC 7208 recommends permerror above two void lookups. Combining a and mx for a domain that no longer exists with a macro-driven exists is a common way to cross the line.

Void lookups depend on live DNS, so a record alone cannot settle them. A checker can only count candidates and warn above two, which is the practical approach.

How to reduce the count

  1. Remove includes for ESPs you no longer use. Stale includes from finished contracts are common.
  2. Replace several includes from one provider with the single include that provider documents.
  3. If an include holds only IPs, write those ranges as ip4 and ip6: the lookups become zero.
  4. Question every a and mx term. Most sending servers have fixed IPs, so ip4 is enough.
  5. For exists-based checks, confirm the generated names really exist.

Nine versus ten

Nine leaves one spare. Add a new ESP or a marketing tool and you reach the limit. Ten is exactly at the cap, with no room to add anything. That is why checkers show nine as a note and ten as a warning. For a production domain, staying at seven or below is safer.

What permerror looks like downstream

Receivers record it differently, but the SPF result is generally permerror and DMARC then counts it as an SPF alignment failure. With p=none you only see it in reports; with p=quarantine or stricter, legitimate mail can be quarantined. Since going over the limit directly affects delivery, periodic checks are worth the effort.

Questions

Does exp= count toward the ten lookups?

No. The RFC 7208 limit applies to include, a, mx, ptr, exists and redirect only. exp= does trigger a separate lookup for the explanation text, so it affects response time.

What is a void lookup?

A lookup that returns no answer or NXDOMAIN. It can happen for a, mx, ptr and exists, and RFC 7208 recommends permerror beyond two void lookups. Only real DNS reveals which ones are void.

Does removing includes break authentication?

Only keep the paths you actually send from. Dropping an unused ESP include, or replacing several with one IP range, keeps results intact while lowering the count.

Paste the included records too and the tool adds the recursion for you.

Open the tool

This guide follows RFC 7208 (SPF), RFC 6376 (DKIM), RFC 7489 (DMARC), the BIMI Group specifications and RFC 8617/8616 (ARC and DMARC aggregate reporting). Every example record is synthetic.