What Is SPF? Sender Policy Framework Explained
Technical Guide - Email Authentication

What Is SPF?

SPF is the DNS record that tells the world which servers are allowed to send email for your domain. This guide covers how it works, the common mechanisms, the 10-lookup limit, and the difference between ~all and -all.

Definition

SPF (Sender Policy Framework) is an email authentication method published as a DNS TXT record. It lists which IP addresses and mail servers are authorized to send email for a domain, so receiving servers can reject or flag spoofed senders.

What SPF Does

When a mail server receives a message, it can check the sender against the domain's published SPF record:

1. Reads the envelope sender

The receiving server takes the domain from the SMTP envelope (the return-path), not the visible From header.

2. Queries the SPF record

It looks up the domain's TXT record starting with v=spf1 and walks the listed mechanisms in order.

3. Evaluates the IP

The connecting server's IP is tested against each mechanism. The first match wins and produces pass, fail, softfail, or neutral.

4. Applies the result

A fail means the message came from an unauthorized server and can be rejected or marked as spam, depending on the receiving provider's policy.

Common SPF Mechanisms

Mechanisms are the building blocks inside an SPF record. Each one defines a set of IPs that are (or aren't) allowed to send.

example.com. IN TXT "v=spf1 ip4:203.0.113.10 ip4:203.0.113.0/24 include:_spf.google.com mx -all"
ip4 / ip6
Allows a specific address or CIDR range, e.g. ip4:203.0.113.10 or ip4:203.0.113.0/24.
include
Delegates to another domain's SPF record. ESPs such as Google and Microsoft publish a record you include so you inherit their senders, e.g. include:_spf.google.com.
a
Allows the IP(s) of the domain's A record.
mx
Allows the IP(s) of the domain's MX mail servers.
all
Matches every sender. Placed at the end as the default rule, usually prefixed with a qualifier: +all (allow), ~all (softfail), -all (hard fail).

The 10-Lookup Limit

Every include, a and mx mechanism counts toward a maximum of 10 DNS lookups per record. This is the most common SPF failure in production:

Use the free BounceZero SPF Checker to read a domain's record and its lookup count in one shot.

~all vs -all

~all (softfail)
Unlisted senders are accepted but marked suspicious. Providers may still deliver them to the inbox. Use this during testing, or when a legacy service might still send and you can't afford a hard fail yet.
-all (hard fail)
Unlisted senders are rejected outright. This is the hardened, production setting - but only safe once every real sender is listed in the record.

The best practice is to run a strict -all policy - combined with DKIM signing and a DMARC record - so every mail server knows exactly who may send as your domain.

FAQ

What is SPF?

SPF (Sender Policy Framework) is an email authentication method published as a DNS TXT record. It tells receiving servers which IP addresses and mail servers are allowed to send email for a domain, helping them reject or flag spoofed messages.

What are the SPF mechanisms?

The common SPF mechanisms are ip4 (a specific IPv4 or range), ip6 (IPv6), include (delegates to another domain's SPF record, used for ESPs), a (the domain's A record), mx (the domain's mail servers), and all (matches everything, used as the default rule at the end).

What is the SPF 10-lookup limit?

Each include, a, or mx mechanism counts toward a maximum of 10 DNS lookups per SPF record. Exceeding the limit causes a permanent error (permerror), and receiving servers treat the record as neutral instead of trusting it. This is why records with many ESP includes silently fail.

What is the difference between ~all and -all?

Both sit at the end of an SPF record as the catch-all rule. ~all means softfail - unlisted senders are accepted but marked as suspicious. -all means hard fail - unlisted senders are rejected outright. A hardened domain uses -all after all real senders are included.

Verify Addresses on Authenticated Domains

Check SPF, DKIM, DMARC and deliverability signals in one pipeline. 100 free verifications.

Start Free

Ready for bulk verification?

Verify Thousands - Same Up to 99.8% accuracy in internal testing on SMTP-verifiable addresses

Upload a CSV, get clean results in minutes. $3 per 1,000 emails. Credits never expire. No subscription.

Get 100 Free Credits View pricing

No credit card required  -  100 free verifications every month  -  Full 5-stage pipeline

Follow BounceZero