[ SPF ]

SPF's 10-lookup limit: trace the evaluation path before fixing it

SPF limits evaluated DNS-dependent terms across the complete path. Nested includes count, early matches matter, and caching does not turn an over-limit path into a compliant one.

By the EmailAuth research team · 7 min read

[ Key points ]

  • The ten-term limit applies across the actual recursive evaluation.
  • Early matches and error paths explain different sender outcomes.
  • Fix dependencies without losing legitimate mail or widening permissions.
On this page

SPF's 10-lookup limit applies to specified DNS-dependent terms evaluated during an SPF check. It is not a rule allowing ten visible include statements in the root record. Nested policies share the evaluation's limit, and an early match can stop the check before later branches are reached.

When the counted-term limit is exceeded, the result is permerror. A useful diagnosis traces the connecting sender through the applicable policy and records where evaluation continues, matches or fails. That trace shows which dependencies need attention and which permissions the business still needs.

Understand what SPF counts

RFC 7208 §4.6.4 identifies include, a, mx, ptr and exists, plus the redirect modifier, as DNS-query-causing terms subject to the overall limit when evaluated. Under RFC 7208 §4.1, referenced policies share the evaluation's global limit rather than receiving fresh independent allowances.

The all, ip4 and ip6 mechanisms do not consume that term limit. The exp modifier does not consume it during the SPF evaluation, although an explanation lookup can occur later. Other limits and operational constraints still apply, including requirements involving MX/PTR expansion and void lookups.

The initial SPF TXT lookup should not be confused with an evaluated include mechanism. A diagnostic should state what its displayed number represents: a protocol-term count, a static expansion estimate, or observed DNS queries.

Worked example: two includes lead to an eleventh term

The following is a synthetic fixture using reserved example domains and documentation IP addresses. It is not live DNS and is not a production record to paste.

The root policy is:

v=spf1 include:billing.example.net include:messages.example.org -all

Assume the billing policy evaluates three further includes, each containing only an ip4 mechanism and -all. Assume the messages policy evaluates six further includes built the same way. Assume every reached policy has one syntactically valid SPF TXT record, all DNS retrievals succeed, each intermediate policy ends in -all and no other terms are present. For this example, none of their authorised addresses matches the connecting sender.

  • Root billing include: running total 1.
  • Three nested billing includes: running total 4.
  • Root messages include: running total 5.
  • First five nested messages includes: running total 10.
  • Sixth nested messages include: would exceed the limit, producing permerror.

The root contains only two visible includes. The complete non-matching path attempts an eleventh counted term.

Now consider a different sender that matches the first nested billing policy. In this fixture, it can pass after two counted includes. Evaluation does not continue through the later message-service branch just to use up the allowance.

This is why a path trace and its input address matter. It is also why a static expansion tool and a receiver's particular evaluation can display different-looking counts without measuring the same thing.

Trace the actual failing evaluation

Collect the connecting IP, the SPF-evaluated envelope domain, the complete relevant TXT answers and the receiver's diagnostic. Preserve timing: a provider's referenced policy can change after the original delivery.

Record each counted term reached, the referenced policy and the result that causes evaluation to continue, match or fail. Distinguish an excessive-term error from malformed syntax, several SPF records, a circular dependency or a temporary DNS failure.

A root-record lookup helps establish the starting point:

dig TXT example.com. +noall +answer

The BIND dig manual documents these DNS-query/display options. It does not, by itself, evaluate SPF or establish the lookup count. A DNS query command is not a substitute for the trace.

Choose a maintainable correction

Start with obsolete permissions. Confirm that an include is no longer needed before removing it; shared services and seasonal mail can make a quiet interval misleading.

For active services, check the provider's supported configuration. A dedicated sending subdomain or a supported custom envelope identity may reduce unrelated dependencies and improve governance, but the identities and alignment still need verification.

Changing mechanism order can alter the evaluated path. Test representative legitimate and non-matching inputs rather than moving the busiest service first and declaring the entire policy fixed.

Flattening can replace referenced policies with address data and reduce counted terms. It also creates maintenance work: provider address changes must be reflected, obsolete permissions removed and failures detected. Record-length and DNS constraints do not disappear. Do not use broad ranges or permissive +all as a shortcut.

Check the effect on legitimate services

A business can reach this problem after years of adding services to the same domain. Old includes remain, providers add dependencies and nobody owns the full permission set.

Ask for a service-level explanation: which legitimate messages encounter the failing path, which permissions are still needed and who will maintain the replacement. The cheapest apparent fix can become expensive if it copies provider addresses into a record that nobody keeps current.

Judge the outcome by restored legitimate mail and controlled permissions. A lower checker count is useful evidence, but it is not the whole business result.

Verify the resulting permissions and DMARC alignment

Require a maintained service-to-permission map, an accountable change and evidence for all affected legitimate routes. Ask whether the fix introduced a new live DNS dependency, outsourced maintenance or retained unnecessary infrastructure access.

Track the reason for each permission and the condition for retirement. A technically valid SPF policy can still authorise too much. It also does not establish sender reputation or the safety of a message's contents.

After correction, re-evaluate the previously failing inputs and representative legitimate traffic. Then verify DMARC alignment separately. A restored raw SPF pass for an unrelated envelope domain does not fix an alignment failure.

The practical takeaway

A successful correction demonstrates a compliant evaluation for the relevant inputs and continued legitimate sending. Keep the dependency trace and the reason for each retained permission. Then verify alignment on real messages; a repaired raw SPF result is only one part of DMARC.

Record the next decision

The nonmatching fixture has 1+3+1+6=11 attempted counted terms; the sixth nested messages include exceeds the limit after 10. The early billing match needs only two includes. Retain this assumption set with any tool comparison and label graph expansion separately from evaluated-path count. No evaluator or network query was executed for these examples.

[ Takeaway ]

The ten-term limit applies across the actual recursive evaluation. Early matches and error paths explain different sender outcomes. Fix dependencies without losing legitimate mail or widening permissions.

[ By role ]

What this means for you

Choose your role for practical next steps.

IT / Mail Admin

Trace inputs rather than counting visible includes.

Collect the connecting IP and SPF-evaluated identity, then follow each counted term reached in the relevant policies. Preserve answers and timing because dependencies can change.

Next steps

  1. Check nested includes and redirect processing.
  2. Test early-match and non-matching paths.
  3. Verify legitimate sending and DMARC alignment after correction.

CISO / SecOps

Review the permissions left behind.

A valid count can coexist with excessive authorisation. Review the service-to-permission map, maintenance model and exceptions created by a redesign.

Next steps

  1. Require a business reason for retained permissions.
  2. Avoid broad ranges or +all as a shortcut.
  3. Track responsibility for dependency and provider changes.

Founder / Non-technical

Ask what broke and who will maintain the fix.

The issue often accumulates as new services are added and old permissions remain. A sustainable fix identifies the affected messages and keeps provider-dependent data current.

Next steps

  1. Ask which legitimate workflow reaches the failing path.
  2. Confirm obsolete services before removing permissions.
  3. Require an owner for any flattening or address-refresh process.

[ FAQs ]

Frequently asked questions

Is the SPF limit ten include statements in my root record?

No. Count evaluated DNS-dependent terms across the complete path, including referenced policies. Two visible includes can lead to more than ten counted terms.

RFC 7208 §4.1 RFC 7208 §4.6.4

Does an SPF include receive its own separate allowance of ten?

No. The overall limit is tracked globally for the evaluation, including recursive include and redirect processing.

RFC 7208 §4.1 RFC 7208 §4.6.4

Do ip4 and ip6 consume the same lookup allowance?

They do not consume the specified DNS-dependent term limit. That does not make guessed or overly broad address permissions a safe replacement for maintained service configuration.

RFC 7208 §4.6.4

Will DNS caching fix an over-limit SPF policy?

No. The protocol limit concerns evaluated terms, not merely cache misses or outbound DNS packets. A cached answer does not erase the term from the evaluation.

RFC 7208 §4.6.4

Why can one sender pass while another reaches permerror?

An early matching mechanism can stop evaluation before later dependencies. A different input can reach more of the path and encounter the limit or another error.

RFC 7208 §4.6.2 RFC 7208 §4.6.4

Can I fix this by creating a second SPF record?

No. Multiple applicable SPF policies create another error condition. Correct the single intended policy and its dependencies.

RFC 7208 §4.5

Should we pay for SPF flattening straight away?

First establish the failing path, remove genuinely obsolete permissions and assess supported service designs. Flattening can help, but its address-refresh and maintenance responsibilities need a clear owner and verification.

What should a successful fix demonstrate?

A compliant evaluation for the relevant test inputs, preserved legitimate sending, justified permissions, a maintained dependency model and the expected DMARC alignment on real messages.

[ Sources ]

Sources

  1. RFC 7208

    Sections §2.4 · §4.1 · §4.5 · §4.6.2 · §4.6.4 · §5.2 · §5.6

  2. RFC 9989

    Sections §4.4 · §4.4.2

  3. BIND dig manual

    Sections dig Synopsis and Query Options

[ Glossary ]

Glossary

SPF
Authorization evaluation for a connecting IP and the relevant SMTP identity.

RFC 7208 §2.4

Evaluated-term limit
The maximum of ten specified DNS-query-causing terms across one SPF evaluation, including recursion.

RFC 7208 §4.1 RFC 7208 §4.6.4

Enterprise provenance

Why top financial institutions and governments retired their email security dashboards.

Traditional email authentication platforms sell you a dashboard and ask your engineers to do the labour. In high-stakes environments, manual oversight means delayed enforcement, configuration drift and unmonitored shadow domains.

EmailAuth is the agentic email provenance platform. Our agents enforce p=reject, keep third-party senders aligned and move your domains to full RFC 9989 compliance, the new DMARC standard,, with human-in-the-loop auditability.

Governments Large enterprises Tier-1 financial institutions

SaaS · Dedicated tenancy · Air-gapped on-prem · BYOK encryption

Knowledge Base