Too many included lookups (12): fix the SPF limit in MXToolbox
"Too many included lookups (12)" means MXToolbox counted 12 DNS-querying terms in your SPF record, and the limit is 10 (RFC 7208). Receivers can return a permanent SPF error. Remove unused includes, replace stable ones with ip4 ranges, or move senders to subdomains, then recheck.
Sohail Hussain8 min readShort answer
- Your SPF record needs 12 DNS lookups to evaluate and the limit is 10, so receivers can return a permerror. Get the count to 10 or fewer.
- Remove includes for services that no longer send, move some senders to their own subdomain, and flatten only stable IP ranges. Then rerun the MXToolbox SPF check.
You ran your domain through MXToolbox and got this:
Too many included lookups (12)
The number in parentheses is how many lookups MXToolbox counted while walking your record and everything it includes. It is not the number of include: terms you typed. Most records that hit this error have five or six includes that expand to 12 once the providers' own nested includes are counted.
Why it happens
The SPF standard, RFC 7208, says the terms include, a, mx, ptr and exists, plus the redirect modifier, cause DNS queries. Implementations must limit those terms to 10 during evaluation, and must return permerror if the limit is exceeded. The all, ip4 and ip6 terms do not cause queries and are not subject to the limit.
The usual causes, most common first:
- Nested includes. If your record includes a domain, and that domain includes others in its own SPF record, those others count toward your limit. Microsoft's example: an include that points to a record with three more includes adds four lookups in total.
- Too many third-party senders. A CRM, helpdesk, newsletter tool, billing tool and your mailbox provider each add their include.
- Old services nobody removed. Trials and retired tools still sit in the record.
- A provider changed its own record. If you are near 10 and someone you include adds records to their SPF, you can easily go over. That is why a record that passed last quarter can fail today.
- Unneeded
aandmxterms. Each costs a lookup, and themxterm can cost more.
Does exceeding the limit break all your mail? Not always. Evaluation stops once the sending source is matched, so some mail sources at some receivers never reach the lookup that breaks. That makes the failure intermittent, which is the worst kind to debug. I would not rely on it.
| Cause | Typical symptom | Fix |
|---|---|---|
| Nested provider includes | Count higher than your include list suggests | Remove or relocate senders |
| Dead services | Includes for tools nobody uses | Delete the include |
| Provider record grew | Count rose with no change by you | Recount; move a sender to a subdomain |
| Two SPF records | Multiple records warning | Merge into one record |
| Dead include domains | Void lookup warning | Remove the dead include |
Fixes, in the order I would try them
1. Count and map the lookups
- Open MXToolbox's SPF lookup for your domain and expand the tree.
- Write down each top-level
include,a,mxandredirect, and how many lookups sits under each. - Mark the expensive ones. Large mailbox and marketing providers often add several each.
- Use our SPF lookup count calculator to tally, and keep the printout for a before-and-after comparison.
2. Remove what you no longer use
This is the cheapest fix and often enough on its own. Google's guidance is to include only domains that actively send mail for you, and to remove includes for third parties that no longer do.
- For each include, identify the service and ask the team that owns it whether it still sends as your domain.
- Delete includes for dead services.
- Remove duplicate terms. Google also advises removing duplicate mechanisms and mechanisms that refer to the same domain.
- Drop
mxandaunless something really sends from those hosts. - Publish the edited record and recount.
3. Move senders to their own subdomain
SPF is checked against the envelope sender (Return-Path) domain, or the HELO name. If a service lets you set a custom return-path or sending subdomain, give that subdomain its own record:
mail.example.com. TXT "v=spf1 include:sendgrid.net ~all"
Each subdomain has its own 10 lookup budget. The UK government's guidance makes the same suggestion: services that send mail can use subdomains with their own SPF records instead of sitting in the parent record.
Check your DMARC alignment first. Some services put their own domain in the Return-Path and rely on DKIM for alignment, so read each service's setup guide before you move it.
4. Replace stable includes with IP ranges
ip4 and ip6 cost no lookups:
example.com. TXT "v=spf1 ip4:203.0.113.0/24 include:_spf.google.com ~all"
The risk is staleness: a provider changes its IPs and your copy silently stops authorizing them. Microsoft says flattening suits vendors with stable, documented IP ranges, and services that rarely change sending IPs. I would use it for your own servers, and skip it for large shared platforms.
5. Flatten with care, or use a service
Flattening resolves includes to IPs and publishes them directly. Costs to know about:
- SPF records have a 255-character string limit, so long records need to be split into several quoted strings inside one TXT record.
- A static flattened record goes stale without warning when a provider rotates IPs.
- MXToolbox itself offers an SPF flattening tool as part of its Delivery Center Plus plan. Any automated flattening service means trusting a third party with a record that controls your mail authentication, so monitor it.
People on sysadmin forums report the same tension: flattening fixes the count but creates a maintenance duty. Manual flattening needs a scheduled recheck.
One record only
A domain must have a single SPF TXT record. Two records starting with v=spf1 produce a permerror on their own. Merge everything into one record and end it with ~all or -all.
6. Check void lookups too
MXToolbox reports these separately. Void lookups are DNS queries that return an empty answer or NXDOMAIN, and they are counted separately from the 10-lookup total. The RFC says implementations should limit them to two. A dead include domain can therefore hurt twice.
Verify the fix
- Publish the new TXT record at your DNS host. If your host shows the value in quotes, enter it the way the host expects; do not add a second record.
- Wait for the old TTL to expire. Microsoft recommends a minimum TTL of 3600 seconds (one hour) on SPF records, and Google suggests allowing 24-48 hours for fixes to take effect.
- Rerun the MXToolbox SPF lookup. Confirm the count is 10 or less and no warnings remain.
- Send a test message to a Gmail address, open Show original, and look for
spf=pass. Our email header analyzer helps read the result. - Watch DMARC aggregate reports for a week or two to catch senders you missed.
Recount after provider changes
Your count can rise when a provider edits its own SPF record. Recheck after adding any new tool, and again every few months.
Checklist before you call it fixed
- Exactly one
v=spf1record on the domain. - Total lookups at 10 or fewer, including nested ones.
- No void lookup warnings.
- Every include maps to a service you confirmed still sends.
- Flattened IP ranges, if any, have a recheck date.
- DKIM passes and aligns for each sender, so DMARC does not depend on SPF alone.
If nothing works
If the count stays above 10 after you trim, the problem is usually a sender you cannot remove. Ask that vendor whether it supports a custom return-path or sending subdomain, or whether it publishes a smaller include. Contact your DNS host if your record changes do not appear.
Subject: SPF include for {your-domain} exceeds the 10 lookup limit
Hello,
MXToolbox reports "Too many included lookups (12)" for {your-domain}.
Our SPF record includes your domain ({vendor-include}).
Could you tell us:
1. How many DNS lookups your include adds.
2. Whether you support a custom return-path or sending subdomain, so we can publish a separate SPF record.
3. Whether you publish stable IP ranges and how you announce changes.
Current record: {paste your v=spf1 record}
Date checked: {date}
Thank you.
Where Mailneo fits
Mailneo sends through the mailboxes and providers you connect, so your SPF record is yours to edit at your DNS host; we cannot change or flatten it for you. What we do is check the SPF record (including the include chain), DKIM and DMARC for connected accounts and tell you whether they authorize the provider you use. See the email accounts documentation.
Common questions
Is 12 lookups really a problem if my mail still arrives?
Yes. It may arrive today because some receivers stop evaluating once they match your sender, but a receiver that walks the whole record gets a permerror. The result depends on the receiver and on your DMARC policy.
Does ip4 count toward the limit?
No. The all, ip4 and ip6 mechanisms do not count because they need no DNS lookup.
Can I fix this by writing fewer include: terms?
Only if the ones you remove carry nested lookups. Fewer than 10 includes does not guarantee fewer than 10 lookups, because nested ones count.
Where can I learn the basics of SPF, DKIM and DMARC?
Start with our SPF, DKIM and DMARC walkthrough and the SPF glossary entry. The SPF generator helps when you rebuild the record.
Explore: Email Deliverability
Related Articles
0x800ccc0e: Outlook Unable to Connect to SMTP Server, Fixed
Outlook error 0x800ccc0e means the app could not open a connection to your outgoing (SMTP) server. Usually the port, encryption setting or password is wrong, or antivirus, a firewall or your ISP is blocking it. Set port 587 with STARTTLS, turn on SMTP authentication, and test again.
SocketLabs "421 4.5.1 Too many errors" blacklist: how to fix it
`421 4.5.1 Too many errors, you have been temporarily blacklisted` means a SocketLabs server saw repeated auth or bad-address errors from your IP and paused it. Stop whatever is retrying, fix credentials and invalid recipients, clear the queue, and wait. The block usually lifts within minutes, but returns if retries resume.
421-4.7.0 Gmail Has Detected This Message Is Suspicious: Fix
The 421-4.7.0 "suspicious due to the nature of the content and/or the links" error means Gmail's content filter rejected your message after DATA, not an authentication check. Remove click tracking or move it to your own domain, drop URL shorteners, check link reputation, then retest with a plain message.
421 4.7.0 IP not in whitelist for RCPT domain: what it means
The error 421 4.7.0 IP not in whitelist for RCPT domain means the recipient's mail gateway, usually Mimecast in reports, only accepts connections from approved IPs, and the Google sending IP isn't on that list. The fix is on the recipient side: their admin must allow the IPs or change the mail routing.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free