Skip to main content

How SPF's 10-DNS-lookup limit actually works

· 3 min read
AntAPI team

SPF limits the number of DNS-lookup-causing terms evaluated while checking a message. The limit is 10 across the evaluation, including nested policies. Counting only the include strings in the first TXT record is not enough to prove that a policy stays within the limit.

Which terms count?​

RFC 7208 identifies include, a, mx, ptr, exists and redirect as lookup-causing terms. ip4, ip6 and all do not use this budget. The rule concerns SPF evaluation, not simply the number of DNS packets visible in a network capture; additional limits also exist, including limits on void lookups and address processing.

Consider this illustrative policy:

v=spf1 include:sender-a.example include:sender-b.example -all

There are two visible includes. Either included policy can contain more lookup-causing terms. Evaluation can stop when a mechanism matches, so the actual path depends on the sending IP and policy. This example is not a policy to publish: the .example providers are placeholders.

Why a record-level check has limits​

A DNS audit can find multiple SPF records, inspect the terminal all qualifier and flag the lookup-causing terms visible in the record. AntAPI's current dns_lookup_count is a top-level diagnostic, not a recursive expansion of every provider policy or a full SPF result for a message. A low displayed count does not establish a safe worst-case evaluation path.

Start with Email Security Check, then investigate the relevant provider policies if the record is complex. Receiving an SPF permerror calls for checking policy validity and limits; it is different from fail, which indicates that the policy did not authorize the sender.

Reduce complexity without breaking legitimate senders​

  1. Inventory the systems that actually send mail for the domain, using your provider settings and message evidence.
  2. Remove obsolete includes only after confirming the sender is no longer needed.
  3. Review nested dependencies and each provider's supported configuration.
  4. Test real messages after changing the record. Avoid copying provider IPs into a permanent flattened policy without a process to maintain them.

Publish one SPF policy TXT record at the relevant name; multiple quoted strings inside one TXT record are not the same thing as multiple SPF records. SPF evaluates envelope identities, so a pass alone does not establish that the visible From address is aligned for DMARC.

See the DNS and email security API guide for automation and DKIM selector guidance for the complementary signing check.

Source​