Skip to content
MailVet
Glossary

What is an SPF record?

An SPF record is a DNS TXT record that lists which mail servers are allowed to send email for a domain. Receiving servers check it to decide whether a message claiming to come from that domain was sent by an authorized server.

SPF (Sender Policy Framework, RFC 7208) is published as a single TXT record on the domain, starting with v=spf1. It lists IP addresses, and other domains whose servers may send for you, and ends with a rule for everything else.

SPF checks the envelope sender, the Return-Path address used during the SMTP conversation, not the From address people see. That gap is why SPF on its own doesn't stop someone spoofing your visible From domain, and why /glossary/dmarc exists.

An SPF record, piece by piece

One record per domain. Publishing two SPF records is a permanent error (permerror), and receivers won't evaluate either. Check yours with /tools/spf-checker.

DNS TXT record
northwind.example.  3600  IN  TXT  "v=spf1 ip4:203.0.113.25 include:_spf.google.com include:spf.mailer.example -all"

v=spf1                       version tag, must come first
ip4:203.0.113.25             this IP may send (an office or app server)
include:_spf.google.com      plus every server Google Workspace authorizes
include:spf.mailer.example   plus your email platform's servers
-all                         everything else fails

SPF mechanisms and qualifiers

TermWhat it doesCounts toward the 10-lookup limit
ip4:, ip6:Authorizes an IP address or rangeNo
aAuthorizes the IPs in the domain's A or AAAA recordsYes
mxAuthorizes the domain's MX hostsYes
include:Pulls in another domain's SPF policy, such as your email platform'sYes, plus every lookup inside it
exists:Passes if a constructed domain name resolves; for advanced setupsYes
ptrReverse-DNS match. Deprecated; don't use itYes
redirect=Hands the whole policy to another domain's recordYes
-allFail anything not listed (hard fail)No
~allSoft fail: accept, but treat as suspiciousNo
?allNeutral: no statement either wayNo
+allPass everything, letting anyone send as you. Never use itNo

When no qualifier is written, + (pass) is assumed, so ip4:203.0.113.25 means +ip4:203.0.113.25.

The 10-lookup limit

Evaluating an SPF record may trigger at most 10 DNS lookups. Every include, a, mx, ptr, exists and redirect counts, and so does every lookup inside the records you include. Go over and the result is permerror, which counts as an SPF failure for DMARC. The spec also recommends capping lookups that return nothing (void lookups) at two.

The limit is easy to hit once marketing, CRM, support and billing tools each want an include. Remove services you no longer use, and check the total every time you add a new sender. Replacing includes with copied IP ranges ("flattening") keeps you under the limit but breaks silently when a provider changes its IPs.

FAQ

SPF record questions

Should I use -all or ~all?

Use -all once you're confident every legitimate sender is listed; it tells receivers anything else should fail. ~all is a common choice while you're still finding senders. Once DMARC is enforcing, the difference matters less, because the DMARC policy decides what happens to failing mail.

Can a domain have two SPF records?

No. A domain must publish exactly one SPF record, and two records cause a permanent error. To authorize a new service, add it to the existing record.

Does SPF work when email is forwarded?

Often not. A forwarding server sends from its own IP, which isn't in your SPF record, so the forwarded copy can fail SPF. DKIM usually survives forwarding, which is one reason to set up both.

Do I need SPF to send bulk email to Gmail and Yahoo?

Yes. Since 2024, Google and Yahoo require bulk senders to authenticate with both SPF and DKIM and to publish a DMARC policy. Senders below the bulk threshold still need at least SPF or DKIM.

Authentication gets you in the door. A clean list keeps you there.

SPF, DKIM and DMARC prove who you are. Verifying before you send keeps down the bounces providers judge you on.

Related

Last updated November 13, 2026