How SPF works

When a server connects to deliver a message, it announces an envelope sender with the SMTP MAIL FROM command (this address later appears as the Return-Path header). The receiving server takes the domain from that address, looks up its SPF record in DNS, and checks whether the connecting IP address is authorized. If the envelope sender is empty, as it is for bounce messages, the check uses the domain from the HELO or EHLO greeting instead.

An SPF record is a single TXT record at the domain apex:

example.com.  TXT  "v=spf1 ip4:203.0.113.0/24 include:_spf.google.com include:mail.zendesk.com -all"

The record is read left to right. ip4 and ip6 match address ranges directly, include pulls in another domain’s SPF policy (this is how you authorize a third-party sender), and a and mx authorize the IPs behind the domain’s own A or MX records. The first mechanism that matches decides the result. If none match, the final all mechanism applies.

RFC 7208 defines seven possible results: pass, fail, softfail, neutral, none (no record), temperror (a transient DNS problem), and permerror (a broken record). Receivers usually record the outcome in an Authentication-Results header, which you can inspect in the raw source of any delivered message.

SPF qualifiers

The character in front of all sets the default outcome for unlisted servers:

  • -all (fail): mail from unlisted IPs is not authorized.
  • ~all (softfail): mail from unlisted IPs is probably not authorized and should be treated with suspicion.
  • ?all (neutral): the domain makes no assertion.
  • +all (pass): any server on the internet may send for the domain. This defeats the purpose of SPF and should never be published.

The 10-lookup limit

RFC 7208 caps SPF evaluation at 10 mechanisms or modifiers that trigger DNS queries: include, a, mx, ptr, exists, and redirect all count, and lookups inside nested includes count too. It also limits “void” lookups (queries that return no answer) to two. Exceeding either limit produces a permerror, which means SPF fails for every message from the domain, not just the one provider that pushed it over.

Domains reach this limit gradually as teams add a CRM, a help desk, a marketing platform, and a transactional email service, each with its own include. The ptr mechanism is slow and discouraged by the RFC, so it should be removed if you find it.

Why SPF matters

SPF is a baseline requirement at the largest mailbox providers. Google’s sender guidelines require every sender to set up SPF or DKIM, and require bulk senders (more than 5,000 messages a day to Gmail accounts) to set up both, plus DMARC. Yahoo’s sender best practices set similar expectations. Without SPF, your mail is easier to spoof and more likely to be filtered or rejected.

SPF also feeds DMARC. A DMARC pass through SPF requires the envelope sender domain to align with the visible From: domain, so an SPF pass on your email provider’s bounce domain does not help DMARC unless you configure a custom return-path on your own domain.

How to set up and maintain SPF

  1. Inventory every sender. List every system that sends mail using your domain: mailbox provider, ESP, CRM, billing system, support desk, and any on-premises servers.
  2. Publish one record. Combine all authorized sources into a single v=spf1 TXT record using the includes each provider documents.
  3. Count your lookups. Expand nested includes and keep the total at 10 or fewer. Remove includes for services you no longer use.
  4. Use a custom return-path with each ESP that supports one, so SPF aligns for DMARC.
  5. Recheck after every change. Adding a provider is the most common moment an SPF record breaks.
  6. Pair it with DKIM. SPF breaks when mail is forwarded, because the forwarding server’s IP is not in your record. A DKIM signature survives forwarding in most cases.

SPF and list quality

SPF authenticates your sending infrastructure, but it says nothing about whether the addresses on your list exist. A domain with perfect authentication can still damage its sender reputation by sending to invalid mailboxes, and high bounce rates undermine the trust that authentication helps build.

Where RocketVerifier helps

The free email deliverability checker looks up your domain’s SPF, DKIM, and DMARC records and flags common problems. To keep bounces low once authentication is in place, run your list through bulk email verification before each campaign so you only send to deliverable addresses.