Hero background

spf record

SPF (Sender Policy Framework)

In this post:

An SPF record (Sender Policy Framework) is a TXT record in your domain's DNS that lists the servers and services allowed to send email for that domain, so a receiving server can check whether a message came from a source you approved. The standard is RFC 7208, and SPF is one of the three DNS authentication records, alongside DKIM and DMARC.

Publishing one takes five minutes. Keeping it right is harder, because every tool that sends as your company (the mail platform, the CRM, the help desk, the billing system, the cold email tool) needs a place in that single line of text, and the line has hard limits that most teams only discover once mail starts failing.

SPF also checks less than people assume. It looks at the envelope sender, the hidden return address used for bounces, not the From address your recipient reads. That gap is why SPF needs DMARC on top, and why a sending tool can pass SPF on every message without doing anything for your domain.

TL;DR

  • An SPF record is one TXT record per domain. It starts with v=spf1, lists allowed senders with mechanisms such as include, ip4 and a, and ends with an all term that tells receivers how to treat everyone else.

  • SPF validates the MAIL FROM domain (the return path) and optionally the HELO name, never the visible From. DMARC only counts an SPF pass when the MAIL FROM domain aligns with your From domain, so a tool that bounces mail through its own domain passes SPF for itself, not for you.

  • RFC 7208 caps evaluation at 10 terms that trigger DNS queries (include, a, mx, ptr, exists and redirect) and recommends allowing only two void lookups. Exceed either and the result is permerror. Nested includes count, so four include statements can use up all ten.

  • Google recommends ending with ~all, Microsoft recommends -all. RFC 9989 warns that -all can get a message rejected before DMARC ever sees its aligned DKIM signature, so once DMARC is in place we end sending domains with ~all.

  • Each domain and subdomain that sends mail needs its own record. Across a fleet of cold email domains, keep a register of which tools each record authorizes and how many lookups it uses.

  • Test with a real message, not just a DNS checker. Read the spf= result and the smtp.mailfrom domain in the Authentication-Results header, and recount lookups whenever a new tool joins the stack.

What's inside an SPF record

Here's a typical SPF record for a company that sends from Google Workspace, uses SendGrid for product email and runs one server of its own:

v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.5 ~all

Receivers read it from left to right and stop at the first term that matches the sending server.

  • v=spf1 marks the TXT record as an SPF policy. A TXT record without it is ignored for SPF.

  • include: pulls in another domain's SPF record, usually a vendor's, so you don't have to track their IP addresses yourself. If that record matches, so does yours.

  • ip4: and ip6: authorize specific addresses or ranges directly. They cost no DNS lookups, which matters later.

  • a and mx authorize whatever addresses your domain's A or MX records point to. Convenient, and each one uses a lookup.

  • all matches everything that's left, so it always goes last. RFC 7208 says any mechanism after it is ignored.

Each mechanism can carry a qualifier that decides the result when it matches: + for pass (the default), - for fail, ~ for softfail and ? for neutral. In practice the qualifier only gets written on all, which is where the ~all versus -all decision lives. The ptr mechanism also exists, but RFC 7208 says it should not be published, because it's slow and unreliable.

An SPF record split into its v=spf1, include, ip4 and ~all parts with a note on what each one allows, illustrating the anatomy of an SPF record

Two structural rules catch people out. A domain may publish only one SPF record, and if a receiver finds two, the check returns permerror instead of picking one. And a long record can be split into several quoted strings inside one TXT record, which receivers join together without adding spaces, so a split in the middle of a mechanism breaks it.

A domain's published SPF record used as a guest list, with two listed servers passing and an unknown server failing at the door, illustrating what an SPF record does

Which sender does SPF actually check?

Every email carries two sender addresses. The one in the From header is what people see. The other is the envelope sender, given in the SMTP MAIL FROM command and stored as the Return-Path, which is where bounces go. SPF checks the domain of the envelope sender, and RFC 7208 also allows checking the HELO name the sending server introduces itself with. It never looks at the From header.

An arriving email going through a DNS lookup, a comparison with the authorized list and a pass or fail verdict, illustrating how an SPF check works

That's why SPF alone can't stop someone putting your name in the From line. An attacker can send from a domain they own, with an SPF record they wrote, and pass. RFC 9989, the DMARC standard published in May 2026 to replace RFC 7489, makes this point itself: any domain owner, bad actors included, can publish SPF and get a pass. So DMARC uses only the MAIL FROM result and only counts it when that domain aligns with the From domain.

Two identical invoice emails from the same address, one sent by an authorized server and one by an impostor, illustrating the spoofing problem SPF addresses

Here's where this bites in practice. Many email platforms send with their own bounce domain in the return path by default. The message passes SPF, but for the vendor's domain, so DMARC gets nothing from SPF and leans entirely on DKIM. Many of them let you set a custom return path on a subdomain like bounce.yourcompany.com, which aligns with yourcompany.com under DMARC's relaxed mode. If a tool offers that setting, use it, because it gives DMARC two aligned results instead of one.

SPF, DKIM and DMARC drawn as the three legs of one stool, each answering a different question about a message, illustrating how SPF works with DKIM and DMARC

Counting toward the 10-lookup limit

This is the rule that breaks the most SPF records. RFC 7208, section 4.6.4, says SPF implementations must limit the terms that cause DNS queries (include, a, mx, ptr, exists and redirect) to 10 per evaluation, and return permerror if the limit is exceeded. ip4, ip6 and all don't count. The same section recommends a limit of two void lookups, meaning queries that come back empty or for a name that doesn't exist, with permerror past that.

The catch is nesting. Every include counts, and so does every include inside the record it points to. We looked up four common vendor records in October 2026:

  • include:_spf.google.com costs 1 lookup.

  • include:sendgrid.net costs 2, because it includes a second SendGrid record.

  • include:_spf.salesforce.com costs 2, because it uses an exists check.

  • include:mailgun.org costs 5, because its record nests two levels deep.

That's 10 lookups from four includes, with nothing left over. Add a CRM's marketing email or a help desk and the record fails for every message, including the ones from Google. Vendors change their records without notice, so a record that counted 9 last year can count 11 today. Microsoft's SPF documentation spells out the same trap: fewer than 10 include statements doesn't guarantee fewer than 10 lookups. Google's Workspace help simplifies the rule to "up to 10 include: tags", which is how many teams end up over the limit while believing they're under it.

Void lookups usually come from dead vendors. You stop using a tool, it removes its SPF record, and your include now points at nothing. One of those is tolerated. Three is a permerror.

There are three ways back under the limit. Remove includes for tools you no longer use, which is often enough on its own. Move a sending tool to its own subdomain, which gets its own record and its own budget of ten. Or flatten, replacing an include with the vendor's IP ranges. Microsoft says not to flatten its own include because its addresses change often, and to review any flattened entries at least quarterly. We use subdomains first and flatten only for vendors with stable, published ranges.

~all or -all, and why Google and Microsoft disagree

The qualifier on all decides what happens to mail from servers you didn't list. RFC 7208 defines a fail (-all) as an explicit statement that the server isn't authorized, while leaving the response to local policy. A softfail (~all) means the domain believes the server isn't authorized but won't make a strong statement, and receivers should not reject on that result alone.

The two biggest mail platforms give opposite advice. Google's SPF setup guide recommends ~all, with v=spf1 include:_spf.google.com ~all as the Workspace record. Microsoft recommends -all for Microsoft 365, v=spf1 include:spf.protection.outlook.com -all, on the reasoning that you should also have DKIM and DMARC deciding what happens to failures.

RFC 9989 adds the consideration that settles it for us. Some receivers check SPF early in the SMTP conversation, before the message content arrives. A -all fail there can get a message rejected before DMARC processing starts, even when it carries a valid, aligned DKIM signature that would have passed. Those rejections also never show up in DMARC aggregate reports, so you can't see them happening. Once a domain has DMARC at enforcement and DKIM aligned, ~all costs you nothing and avoids that failure mode. For domains that never send mail, -all is the right ending.

SPF records on a fleet of sending domains

Outbound teams rarely send from one domain. A setup built for mailbox rotation might run ten or twenty secondary domains, each with a few inboxes, and every one of them needs a correct SPF record. Google and Microsoft both say each subdomain that sends needs its own record too: an SPF record on yourcompany.com doesn't cover mail.yourcompany.com.

The risk with a fleet is drift. Each domain gets set up once, usually by whoever bought it, and nobody looks again. Then the team switches cold email tools, adds a new include on half the domains and forgets the rest. Those domains start failing authentication without a single error in the sending tool. We keep a register per client with every sending domain, the tools its SPF record authorizes, its lookup count and the date it was last checked. It's a dull spreadsheet, and it's the thing that catches a broken record before reply rates do.

Email authentication moving from an optional extra to a hard requirement, with unauthenticated mail refused in the enforcement era, illustrating why an SPF record is now required

The cost of a failing record has gone up. Google requires SPF or DKIM from every sender and both from bulk senders, and its sender guidelines FAQ says enforcement has been ramping up since November 2025, including temporary and permanent rejections. The rest of those rules sit under email deliverability. For a fleet, the point is that one stale record now means one domain's mail stops arriving, which drags down the domain reputation and sender reputation you spent weeks building in your sending infrastructure.

Setting up an SPF record and testing it

The work is mostly inventory. The DNS change is the small part.

  1. List every sender. Your mail platform, marketing tool, CRM, help desk, billing, website forms, cold email tools, and anything else that sends with your domain in the return path. If you already publish DMARC with reporting, the aggregate reports show sources you forgot about.

  2. Write one record. If an SPF record already exists, add to it instead of creating a second. Put tools you don't fully control on a subdomain where you can.

  3. Count the lookups before publishing, including nested includes. Stay comfortably under ten so the next vendor change doesn't tip you over.

  4. Publish it at your DNS host. You make the change where your domain's DNS is hosted, not in the Google or Microsoft admin console. Microsoft recommends a TTL of at least 3,600 seconds, and Google says it can take up to 48 hours for the record to start working.

  5. Send a real test to an inbox outside your organization and open the original. The Authentication-Results header should show spf=pass with smtp.mailfrom set to your domain or one of its subdomains. A pass for a vendor's domain is the alignment gap from earlier.

  6. Repeat after every change to the stack, and include SPF in every outbound deliverability audit.

SPF is one part of DNS authentication, and testing it alone tells you little. Check the DKIM signature and the DMARC result in the same header while you're there.

In short

An SPF record is a short list with strict rules. It names who may send as your domain, it's checked against the return path rather than the From line, and it stops working the moment it needs an eleventh lookup or meets a second record on the same domain. The usual failure is slow: each new tool adds an include, and nobody keeps count until the record breaks.

On its own, SPF proves little that a receiver will act on. Its value comes through DMARC alignment, next to an aligned DKIM signature, which is why the useful question is never just whether SPF passes but for which domain. Get that right and nobody has to think about SPF again: it sits under the GTM system that runs your outbound, and the messages your automated prospecting sends reach real inboxes.

When Nebor sets up sending for a client, the SPF records are published in DNS for each of the client's domains, and we keep a register beside them of every domain, the tools it authorizes and its lookup count. That register stays with the client after the project, so the next person who adds a tool can see what the record already carries.

Frequently asked questions

Can a domain have two SPF records?

No. A domain may publish only one SPF record, and RFC 7208 says that if a receiver finds more than one, the check returns a permanent error rather than choosing between them. This usually happens when a new tool's setup guide says to add an SPF record and someone creates a second one. The fix is to merge both sets of mechanisms into a single record.

Is SPF enough without DKIM and DMARC?

No. SPF only proves that a server was allowed to send for the return-path domain, which an attacker can set to a domain they own. It says nothing about the visible From address or whether the message was changed in transit. DKIM covers the message itself, and DMARC ties both checks to the From domain and tells receivers what to do when they fail.

Does Gmail require an SPF record?

Gmail requires every sender to authenticate with SPF or DKIM, and bulk senders need both, plus a DMARC policy. In practice, every domain that sends email should have an SPF record anyway, because it costs nothing and many receivers treat missing authentication as a reason to filter or refuse mail.

Why does SPF fail on forwarded email?

When a message is forwarded, for example from an old alumni address to a personal inbox, the forwarding server delivers it from its own IP address. That address isn't in the original sender's SPF record, so SPF fails at the final destination. DKIM signatures usually survive forwarding, which is one reason DMARC accepts either an aligned DKIM pass or an aligned SPF pass.

What SPF record should a domain that never sends email have?

Publish v=spf1 -all. It tells receivers that no server is allowed to send mail for that domain, which makes parked or defensive domains much less useful to spammers looking to impersonate you. Microsoft recommends exactly this record for parked domains. Pair it with a DMARC record set to reject so the domain is covered for the visible From address too.

What does SPF permerror mean?

A permerror means the receiver couldn't evaluate your SPF record at all, because of a problem in the record rather than a temporary DNS issue. The usual causes are more than 10 DNS lookups, more than two void lookups, two SPF records on the same domain, or a syntax mistake such as a typo in an include. Receivers generally treat it as a failure.

What is SPF flattening, and is it safe?

Flattening replaces include statements with the IP ranges they resolve to, which saves DNS lookups. It's safe only for vendors whose sending addresses are stable and documented. If a vendor adds new servers, your flattened record silently stops covering them. Microsoft advises against flattening its own include and suggests reviewing flattened entries at least every quarter. Moving tools to subdomains is usually the cleaner fix.

How do you find a domain's current SPF record?

Look up the domain's TXT records. On a Mac or Linux machine, the command dig TXT yourdomain.com lists them, and on Windows, nslookup -type=txt yourdomain.com does the same. The SPF record is the one that starts with v=spf1. Free online SPF checkers show the same record and usually count its DNS lookups for you, nested includes included.

Does an SPF pass mean an email will reach the inbox?

No. A pass only confirms that the sending server was authorized for the return-path domain. After that, providers judge the message on the sender's reputation, complaint and bounce history, how recipients engage and the content itself. A fully authenticated email sent to a poor list can still land in spam. SPF gets you considered, and the rest of your sending decides where you land.

Share this post

Deliverability

Email

Infrastructure

Revenue tips, Weekly

Workflows, automation strategies, and GTM insights delivered straight

Ready to build your
GTM engine

Let's talk about your sales challenges and how we can help you scale

Nebor brand chevron in purple, section accent
Nebor brand chevron in orange and purple, section accent
Revenue tips, Weekly

Workflows, automation strategies, and GTM insights delivered straight

Ready to build your
GTM engine

Let's talk about your sales challenges and how we can help you scale

Nebor brand chevron in purple, section accent
Nebor brand chevron in orange and purple, section accent

Ready to build your pipeline

Let's discuss how to implement lead generation into your GTM strategy

Let's discuss how to implement lead generation into your GTM strategy

Book a call with our team to discuss how this workflow fits your sales process and timeline.

Services

Case Studies

Resources

About

Services

Case Studies

Resources

About

Nebor logo, a go-to-market and RevOps agency based in Amsterdam

Services

Case Studies

Resources

About

Nebor logo, a go-to-market and RevOps agency based in Amsterdam

31 best performing outbound plays for 2027

The strategy behind each play and the automation that puts it to work.

×