Skip to content

Demo mode. Stripe keys are not set, so the $9 report unlocks without a charge. Add the keys before you take a real payment.

WhyInSpamWhyInSpam home

Guides · Updated 2026-11-24

How to fix SPF when it has too many DNS lookups

SPF allows 10 DNS lookups. Past that, the check errors and a lot of mail is treated as unauthenticated. Here is what counts, and how to get back under the limit.

Receivers walk your SPF record before they decide whether the server handing them mail is allowed to use your domain. The walk is capped. RFC 7208 says an SPF check may perform at most 10 DNS lookups. Lookup number 11 does not fail softly. The result is a permanent error, and Gmail and Microsoft then have one less reason to trust the message.

What spends a lookup

These mechanisms each cost one lookup, and then the lookups inside them count too:

  • include
  • a
  • mx
  • ptr
  • exists
  • redirect (only when the record has no all, because all always matches and the redirect is never used)

These do not cost a lookup: ip4, ip6, and all.

A record that looks short can still be expensive. include:_spf.google.com is one lookup plus whatever Google's own record includes. Add Microsoft, a helpdesk tool, a newsletter tool, and a leftover include from a vendor you cancelled, and you are over 10 without a single ip4 in sight.

What the broken record looks like

You have one TXT record, it starts with v=spf1, and it ends in ~all or -all. Syntax is fine. The failure is the walk. Tools report "too many DNS lookups" or "permerror". Mail still leaves your server. The receiver just cannot finish SPF.

Two other shapes cause the same permanent error:

  • Two TXT records that both start with v=spf1. There must be one.
  • An include that points at a name with no SPF record. Two of those void lookups are enough to fail the check.

How to get back under 10

  1. List every service that actually sends as your domain. Marketing, invoices, support, the calendar app, the server that sends password resets.
  2. Delete includes for tools you no longer use. This is the usual fix.
  3. Do not add a second SPF record "just for the new tool". Merge the new include into the one record.
  4. Prefer a provider's single include over a hand-copied list of a and mx mechanisms. mx looks cheap and still costs a lookup.
  5. If you truly need many senders, ask a provider about a flattened include, or send the extra mail through one service that is already listed. Flattening by pasting hundreds of IP addresses works until those IPs change.
  6. Keep ~all or -all as the last mechanism. Anything after all is ignored. +all and a bare all authorize the whole internet. ?all takes no position.

~all is the safer ending while you are still finding senders. -all tells receivers to fail anyone you did not list. Switch to it only after mail you care about is aligned.

A record that usually fits

A company that only sends from Google Workspace:

v=spf1 include:_spf.google.com ~all

Google Workspace and Microsoft 365 together:

v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all

That second one is already several lookups once the includes are opened. Leave room before you add a third vendor.

WhyInSpam counts these lookups, including nested includes, when you scan the sending domain. Ten is a pass. Eleven is the finding.