“SPF too many DNS lookups” means your SPF record needs more than 10 DNS queries to evaluate. The SPF standard caps that number at 10, and a receiver that hits the cap stops and returns permerror. Your SPF then fails for every message, which under DMARC is the same as having no SPF at all. The fix is to cut the number of lookups, not to ignore the warning.
What the RFC says
RFC 7208 section 4.6.4 limits the terms that cause DNS queries:
- The
include,a,mx,ptrandexistsmechanisms and theredirectmodifier each count as one. - Implementations “MUST limit the total number of those terms to 10”.
- Going over returns permerror.
- Lookups inside an included record count toward your total.
- Receivers should also allow no more than two void lookups (queries that return nothing), and exceeding that is a permerror too.
ip4, ip6 and all do not cost anything.
Why the limit exists
Each SPF check makes the receiving server perform DNS queries on the sender’s behalf. Without a cap, one message could trigger hundreds of lookups, which would slow mail servers and could be abused to flood DNS servers with traffic. RFC 7208 sets the limit to protect receivers, so they enforce it strictly: there is no grace for an 11th lookup, and big mailbox providers do not make exceptions for well-known senders.
The limit applies per check, not per day or per message size. A record that needs 11 lookups fails every single time.
How to count your lookups
Count by hand, recursively. Take this record:
v=spf1 include:_spf.google.com include:mail.example-crm.com mx a ~all
| Term | Lookups |
|---|---|
include:_spf.google.com |
1, plus every include inside Google’s record |
include:mail.example-crm.com |
1, plus any inside it |
mx |
1 |
a |
1 |
Then open each included record to count its nested terms:
dig +short TXT _spf.google.com
dig +short TXT mail.example-crm.com
Any include: you see in those answers adds one more, and you repeat for them. Large providers often use several nested includes, so three or four vendors can reach 10 quickly. A checker tool does the recursion for you; ours is in tools.
Fixes, from safest to riskiest
1. Remove what you no longer use
Old records collect includes for tools you cancelled years ago. Each one still costs lookups, and if the vendor’s domain no longer publishes SPF it becomes a void lookup. Your DMARC aggregate reports show which services actually send as your domain; anything that never appears is a candidate for removal.
2. Drop a, mx and ptr where you can
mx authorizes your inbound mail servers to send. If you use Google Workspace or Microsoft 365, their include already covers outbound mail, so mx is often redundant. a authorizes your web server, which usually should not be sending mail directly. ptr should never be published (section 5.5). If a server you run does need to send, list it with ip4: instead, which costs nothing.
3. Move email services to their own return-path subdomain
This is the best structural fix. SPF is checked against the envelope sender’s domain. If your app email service sends with a return-path like send.acme.com, its SPF record lives on that subdomain and costs nothing on acme.com:
acme.com. TXT "v=spf1 include:_spf.google.com ~all"
send.acme.com. TXT "v=spf1 include:amazonses.com ~all"
Most transactional and marketing services support a custom return-path (sometimes called a custom MAIL FROM or bounce domain). It still aligns with acme.com for DMARC under relaxed alignment, the default in RFC 7489.
4. Rely on DKIM for some senders
DMARC passes if either SPF or DKIM passes and aligns. A service that signs with your domain via DKIM does not strictly need to be in your SPF record for DMARC to pass. You would still lose SPF as a backup for that service, so treat this as a tradeoff rather than a free win.
5. Flatten, carefully
Flattening replaces includes with the IP ranges they currently resolve to:
v=spf1 ip4:198.51.100.0/24 ip4:203.0.113.0/24 include:_spf.google.com ~all
It gets you under the limit, but providers change their ranges without notice. When they do, your flattened record silently stops authorizing their new servers. If you flatten, use a service that refreshes the record automatically, and never flatten a provider that tells you not to.
Do not split into two records
A tempting shortcut is to publish two SPF records with half the includes each. That makes things worse: two records is its own permerror (section 3.2). If you need structure, use one record with an include: that points at a second name you control, such as include:_spf2.acme.com. That still counts lookups in total, but it keeps the record readable.
How to confirm the fix
- Recount the lookups after your edit.
- Wait for the old record’s TTL to pass.
- Send a test to Gmail and Outlook and check the
Authentication-Resultsheader forspf=pass. - Watch the next week of DMARC reports for any service that now fails.
Mailcandor and the lookup limit
Mailcandor never asks you to add an include to your main SPF record. It uses a return-path on send.yourdomain with its own SPF record and bounce MX, so your root record’s lookup count does not change. See the SPF record guide for full syntax.