Deliverability

SPF PermError: Too Many DNS Lookups (10-Lookup Limit) Fix

SPF allows 10 DNS-querying terms per check (include, a, mx, ptr, exists, redirect). Go past that and receivers return permerror, which counts as a fail. Fix it by removing unused includes, dropping mx/a/ptr, moving services to subdomains, flattening only senders you control, and keeping a single SPF record.

Sohail HussainSohail Hussain9 min read

Short answer

  • Your SPF record needs more than 10 DNS-querying terms to evaluate, so receivers return permerror and treat SPF as failed. Nested includes count, and the vendors behind them can add more without you touching DNS.
  • Count lookups recursively, delete includes for services you no longer use, drop mx, a and ptr, and publish exactly one v=spf1 record.
  • If you still sit above 10, move bulk senders to a subdomain with its own record, and make sure every sender signs with aligned DKIM so DMARC can still pass.

You saw PermError SPF Permanent Error: Too many DNS lookups in a checker, or spf=permerror in a message header, and your mail may still be arriving. That is the problem: nothing visibly breaks, so people spend weeks on content and list quality instead of DNS.

Why it happens

SPF has a hard cap on how much DNS work a receiver does. RFC 7208 names the terms that cause DNS queries: the include, a, mx, ptr and exists mechanisms and the redirect modifier. Implementations must limit the total to 10, and must return permerror when it is exceeded. The all, ip4 and ip6 mechanisms and the exp modifier are not subject to the limit.

The common causes, most frequent first:

  1. Nested includes. Nested lookups count toward your limit: if your record includes a domain and that domain includes others, those count as yours. Fewer than 10 include: entries does not mean fewer than 10 lookups.
  2. Dead senders. Old CRMs, abandoned newsletter tools and trial accounts that nobody removed.
  3. Host-bundled entries. Shared hosts such as Bluehost may add an include or a/mx entry to your record. If Google Workspace sends your mail and the host does not, that entry costs lookups for nothing.
  4. A vendor grew its own record. If someone you include adds records to their SPF, you can go over 10 without changing anything.
  5. Two SPF records. After a migration, someone adds a new record instead of editing the old one. If more than one record is returned, check_host() produces permerror. This fails regardless of lookup count.
  6. Syntax errors. A syntax error anywhere in the record makes the check return permerror immediately.

Why it fails silently

Receivers handle permerror differently; some reject, some deliver to spam, some lean on DKIM. Checkers also differ. Microsoft's documentation notes that evaluation stops once the message source is validated, so a record can hold enough information to exceed 10 lookups while some checks never go deep enough to hit the error. A green result on one tool, then, does not prove every receiver passes you.

Confirm which cause you have

  1. Send a message to a Gmail address you control, open Show original, and look for spf=permerror next to your domain. You can paste the full headers into our email header analyzer.
  2. Run dig TXT example.com +short and confirm exactly one string starts with v=spf1. Two means cause 5.
  3. Count lookups recursively. A single dig shows one level only. Expand each include: by hand or use a checker that expands them; our SPF lookup count calculator helps with the arithmetic. Google also points admins to the Check MX tool in the Google Admin Toolbox.
  4. Check your DMARC aggregate reports (see below) for SPF failures from your own sending sources.
CauseSymptomFix
Two v=spf1 recordsPermerror even with a short recordMerge into one record
Nested includesCount above 10 after expandingRemove unused includes, split by subdomain
Host-bundled include, mx or aExtra lookups from a service you do not useConfirm with host, then delete
Vendor record grewPermerror appeared with no DNS editRe-expand includes, drop or move the vendor
Syntax errorPermerror on a short recordFix typos, spaces, quotes

Step-by-step fixes

Fix 1: merge duplicate records

Two records like this are a permerror on their own:

example.com. TXT "v=spf1 include:_spf.google.com ~all"
example.com. TXT "v=spf1 include:amazonses.com ~all"

Replace both with one:

example.com. TXT "v=spf1 include:_spf.google.com include:amazonses.com ~all"

Delete the old records rather than leaving both. Our SPF generator can build the merged string. Google's own guidance is to consolidate multiple SPF records into a single record.

Fix 2: cut includes you do not need

  1. List every service that sends as your domain, with an owner for each.
  2. Remove includes for services that no longer send. Google advises including only domains that are actively sending, and removing includes for third parties that no longer send.
  3. Check host-bundled entries (Bluehost or any shared host). Confirm with the host before deleting, because contact forms and WordPress notifications sometimes send through it.
  4. Delete ptr. Replace a and mx with literal ip4:/ip6: entries if the sending server is yours and its address is stable. Note the trade-off: literal IPs break when the server is renumbered, so update them when it moves.
  5. Check whether a vendor offers a different authentication method (SES and SendGrid each document their own). SendGrid's domain authentication may reduce what the root record needs; check their current docs for your setup.

Fix 3: split senders across subdomains

SPF is evaluated per domain name, so each subdomain gets its own record and its own budget of 10. The UK government's guidance makes the same point: services that send email can use subdomains with their own SPF records, outside the parent record.

example.com.         TXT "v=spf1 include:_spf.google.com ~all"
news.example.com.    TXT "v=spf1 include:amazonses.com ~all"
mail.example.com.    TXT "v=spf1 include:sendgrid.net ~all"

Then send bulk mail from news.example.com, with the envelope sender and DKIM domain on that subdomain. As Google notes, if you use subdomains, you must add an SPF record for each one. This also keeps a newsletter reputation problem away from your main domain. With three or more sending services, I'd start here.

Fix 4: flatten only what you control

Flattening replaces an include: with the literal IP ranges it resolves to, so that part costs zero lookups:

v=spf1 ip4:198.51.100.0/24 ip4:203.0.113.0/25 include:_spf.google.com ~all

The risk is staleness: if a vendor changes its IPs and your copy does not, real mail starts failing.

  • Flatten only senders whose ranges are stable or that you own.
  • For third-party ranges, use an automated flattening service so the record refreshes itself.
  • Never hand-flatten Google or Microsoft ranges.
  • Watch the length. Google reminds admins that SPF records have a 255-character string limit.

Cloudflare's CNAME flattening is a different feature and has nothing to do with SPF flattening.

Changing ~all does not help

Switching ~all to -all or ?all does not cure a permerror. The error happens before the final qualifier matters, so the only fix is reducing lookups or splitting the record.

Fix 5: keep DMARC passing while you repair SPF

DMARC passes if SPF or DKIM passes and aligns with the From domain. If SPF is in permerror but every sender signs with DKIM on your domain (or a subdomain under relaxed alignment), DMARC can still pass. Set up aligned DKIM for each sender; our DKIM generator and SPF, DKIM and DMARC setup guide cover it.

Publish a DMARC record with a rua address and read the aggregate reports. They show which sources fail SPF and from which IPs, which is the most reliable way to catch a vendor-driven jump past 10. See DMARC if the term is new.

DNS TXT Record
Type:TXT
Host:_dmarc
Value:v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com

Allow time for changes

Google says SPF fixes can take 24 to 48 hours to take effect globally. Lower the TTL before a batch of edits if you can.

Checklist before you test again

  • Exactly one v=spf1 TXT record per sending domain or subdomain
  • Recursive count is 10 or fewer, with margin for vendor growth
  • No ptr; a and mx only if you truly need them
  • Every active sender is listed; every retired sender is removed
  • Bulk senders sit on their own subdomain with their own SPF and DKIM
  • DKIM signs with your domain for every sender
  • DMARC rua reports arrive somewhere someone reads them

If nothing works

If the count is under 10 and you still see permerror, the record may have a syntax problem, or a vendor's include may be malformed. Contact the vendor whose include looks wrong, or your DNS host if records do not publish as entered. Include the domain, the include name, your expanded lookup count, and a raw header with spf=permerror and its timestamp.

Subject: SPF permerror on example.com (too many DNS lookups)

Hello,

Messages sent from example.com on {date and time, with timezone} show
spf=permerror in the Authentication-Results header (raw header attached).

Our SPF record: {paste the v=spf1 string}
Expanded lookup count: {number}, with {include name} contributing {number}.
Steps already tried: removed unused includes, merged duplicate records.

Could you confirm whether {include name} has recently added nested
includes, and whether you recommend a different authentication method
for our setup?

Thank you

For the standard itself, see RFC 7208's section on DNS lookup limits via the RFC Editor's copy, and Google's Troubleshoot SPF issues page for the admin view.

Where Mailneo helps, and where it does not

For mailboxes you connect, Mailneo checks your sending domain's SPF, DKIM and DMARC records, including whether they authorize the provider you use, and runs blacklist checks. That can surface a broken SPF before you chase content. Mailneo does not edit your DNS, does not flatten SPF, and cannot change a vendor's include; those changes happen at your DNS provider.

Common questions

Does a permerror always send my mail to spam?

No. Receivers react differently: some reject, some junk the message, some rely on DKIM. Microsoft's documentation says its systems can reject with a bounce when SPF returns a permanent error, so do not assume you are safe.

Do ip4 and ip6 entries count toward the limit?

No. They require no DNS lookup, which is why flattening reduces the count. Long lists do run into the 255-character string limit, though.

Can I just raise the limit?

No. The 10-term cap is in the standard, and receivers enforce it on their side. You can only reduce what your record asks them to look up.

Will DMARC still pass if SPF is permerror?

It can, if DKIM passes and aligns with your From domain. Treat that as a safety net while you fix SPF, not a permanent state.

deliverabilitygoogle-workspacebluehostamazon-seserror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

Deliverability

421-4.7.0 Try again later, closing connection (EHLO): fix

The error "421-4.7.0 Try again later, closing connection. (EHLO)" means Google's SMTP server is temporarily refusing your session, usually because of connection volume, a low-reputation IP, or a weak relay setup. Slow down, reuse one connection, queue with retries, authenticate, and send a real EHLO hostname.

Sohail Hussain|11 min read
Deliverability

550 5.4.5 Daily user sending limit exceeded in Gmail: fixes

550-5.4.5 means your Gmail or Google Workspace account used up its sending quota for a rolling 24-hour window. Every recipient counts, including Cc and Bcc, so a few messages can use up the quota. Stop sending, wait, then send smaller batches or move bulk mail to a sending service.

Sohail Hussain|11 min read
Deliverability

550-5.7.26 Unauthenticated Email Rejected by DMARC: Fix

The 550-5.7.26 error means Gmail received mail with your domain in the From address, and neither SPF nor DKIM passed with alignment, so your DMARC policy told Gmail to reject it. Fix it by authenticating the third-party sender with DKIM keys for your domain, or move that sender to a subdomain.

Sohail Hussain|10 min read
Deliverability

550 5.7.26 Sender Is Unauthenticated: Gmail Block, Fixed

The Gmail bounce 550 5.7.26 means the message had no SPF or DKIM pass that Gmail could trust for the From domain, or the domain's DMARC policy said reject. Find your cause (send-as, forwarding, shared DKIM, visitor From addresses, or a moved domain), then publish the matching SPF or DKIM record.

Sohail Hussain|11 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free