SPF: too many DNS lookups
SPF fails with PermError when checking your record takes more than 10 DNS lookups. Each include, a, mx, ptr, exists and redirect costs one, including the ones inside includes. Remove unused includes, drop services that use their own Return-Path, or send bulk mail from a subdomain.
Updated 8 October 2026 by Mohamed Arkid
RFC 7208 limits an SPF check to 10 DNS lookups. Each include,
a, mx, ptr and exists term costs one,
and so does a redirect. Lookups inside an include count too: an include
costs one lookup for itself plus whatever it includes in turn. ip4,
ip6 and all cost nothing.
When a receiver passes 10 it stops and returns PermError. Most receivers treat that as an SPF failure for every message, including mail from servers you did authorize. The checker draws the lookups as a tree, so you can see which include costs the most.
How to get under 10
- Remove includes you no longer use. Former newsletter tools, old hosting providers and trials are the usual ones.
- Check whether a service needs your SPF at all. SPF is checked
against the envelope sender (Return-Path), not the From address. Many sending services
use their own Return-Path domain, often a subdomain of yours such as
bounces.example.comset up with a CNAME. Their SPF is checked there, so their include in your root record adds lookups and nothing else. - Replace
aandmxwithip4orip6when the addresses rarely change. - Send bulk mail from a subdomain.
news.example.comhas its own SPF record and its own 10 lookups.
Flattening, which replaces includes with the IP ranges behind them, also works. Those ranges change without notice, so only flatten with a tool that keeps the record updated.
Questions
What does SPF PermError mean?
It is a permanent error: the record cannot be evaluated as published, because it needs too many lookups, the domain has two SPF records, or the syntax is wrong. Receivers treat it as an SPF failure.
Do ip4 and ip6 count toward the limit?
No. ip4, ip6 and all need no DNS lookup. Only include, a, mx, ptr, exists and redirect count.