SPF too many DNS lookups? Count yours
SPF allows 10 DNS lookups. A record that needs more gets a PermError, and receivers treat SPF as failed. Enter your domain to see which include costs the most and what to remove.
Over the limit
Receivers return a PermError
13of 10
- Your mail provider4 lookups
- Your newsletter tool5 lookups
- Your store's mailer2 lookups
- a and mx2 lookups
The fix
Remove the sender you no longer use, or move the newsletter tool to its own subdomain.
Why SPF stops at 10 lookups
RFC 7208 caps the DNS work a receiver does to check one message. Past 10 lookups, it gives up and returns a PermError.
- Terms that ask DNS 1 lookup each
- include, a, mx, ptr, exists and redirect each send the receiver to DNS. An include also counts every term inside the record it points to, so nested includes add up.
- ip4, ip6, all no lookups
- The receiver reads them straight from your record. Listing addresses costs nothing.
- Void lookups 2 allowed
- A lookup that finds nothing, like an include for a domain with no SPF record, is a void lookup. More than 2 is a PermError too.
How to get back under 10
Take lookups out of the record, or move them somewhere else. Start with what you no longer use.
- Remove senders you no longer use
- Old newsletter tools and past hosts leave includes behind. Check your DMARC reports, then delete the ones that no longer send.
- Swap a and mx for ip4 or ip6
- Where the server keeps the same address, list the address. It costs no lookup.
- Move a sender to a subdomain
- news.example.com has its own SPF record and its own 10 lookups. Set it up in the sending tool first, then remove its include from the main record.
- Be careful with SPF flattening
- Flattening services copy a provider's IP addresses into your record. When the provider changes its addresses, mail from it fails until the copy is updated, and most services need an ongoing subscription to keep it current.
Questions
What is an SPF PermError?
A PermError is a permanent error: the receiving server cannot evaluate your SPF record at all. A record that needs more than 10 DNS lookups causes one, and so do more than 2 void lookups. Receivers then treat SPF as failed, so mail that relied on it can go to spam or be rejected.
Do nested includes count toward the 10 lookups?
Yes. Every include costs one lookup, and so does every include, a, mx, ptr or exists term inside the record it points to. One include for a large sender can cost several lookups on its own, which is why a record with fewer than 10 includes can still go over.
Does ip4 count as a DNS lookup?
No. ip4, ip6 and all are read from your record and cost nothing. Swapping an a or mx term for the server's ip4 or ip6 address saves a lookup, as long as that address stays the same.
Is SPF flattening safe?
It works until your provider changes its IP addresses. A flattening service copies the provider's addresses into your record so it needs fewer lookups. When the provider changes them, mail from that provider fails SPF until the copy is updated, and most flattening services need an ongoing subscription to keep it current. Removing unused senders or moving one to a subdomain has no copy to go stale.
How long until a change to my SPF record works?
Often within minutes, sometimes up to 48 hours, depending on the TTL of the record you changed. Receivers may keep the old record until that time runs out. Results here are saved for 24 hours, so a recount can show the old record until then.
Used to MXToolbox's lookups? See how a graded check with the exact fix compares in the MXToolbox alternative. Not sure which provider's include you need? The MX lookup names it from your MX records.
Ready to rebuild the record? The SPF record generator counts lookups as you tick senders, and merging multiple SPF records walks through joining two records into one.