Short answer
An SPF record is a DNS TXT record that names which hosts may send mail for a domain. Receiving servers compare the connecting address with that record and return a result such as pass, fail, or softfail. RFC 7208 is the specification. The text starts with v=spf1, and a check may use at most 10 terms that look up DNS.
Last verified against the sources listed below.
Key takeaways
- An SPF record is one DNS TXT record for a domain. It authorizes hosts for the HELO and MAIL FROM identities.
- Publish it as TXT only. RFC 7208 dropped the older SPF record type.
- Qualifiers are + pass, - fail, ~ softfail, and ? neutral. A missing qualifier means pass.
- Terms that query DNS are capped at 10. Going past that returns permerror.
- Google's example for Workspace is v=spf1 include:_spf.google.com ~all.
- SPF checks the envelope sender. It is not the same thing as a link in the message body.
What is SPF record, in mail standards, is a short DNS text record that says which hosts may send for a domain. RFC 7208, published in April 2014, names that record the Sender Policy Framework and obsoletes the earlier RFC 4408.
The check happens while the message is still a conversation between servers. It is not a scan of the words inside the message. The sections below cover the record, the check, the DNS form, and the results a receiver can return.
What is an SPF record in email?
An SPF record tells receivers which hosts may use a domain name in the HELO and MAIL FROM identities, and which hosts may not. RFC 7208 defines it that way. Some hosts can fall in neither set, so the record is not always a simple yes or no list.
Microsoft’s SPF page calls SPF a method of email authentication whose primary purpose is to validate email sources for a domain. It uses a TXT record in DNS. Receiving systems use that record to verify the address used during SMTP, which Microsoft also calls the 5321.MailFrom address, the P1 sender, or the envelope sender.
That envelope address is not the From address a person reads in a mail app. SPF does not, by itself, prove the visible name is honest. It answers a narrower question: was this connecting host allowed to use this domain in the envelope?
The same idea sits under ordinary website security only in the sense that both are checks a receiver can run. SPF is a mail check, published in DNS, and it runs before the message body is the thing being judged.
What is an SPF record check?
A check asks one function, check_host(), whether the connecting IP address is authorized for an identity. RFC 7208 recommends that verifiers check the MAIL FROM identity and also check the HELO identity separately. HELO is the name the sending server gave in the SMTP HELO or EHLO command.
The record is read from left to right. Each mechanism can match, not match, or throw an exception, and a match stops the walk and returns that mechanism’s qualifier. No match continues to the next mechanism, while an exception stops the check.
If nothing matches and there is no redirect, the result is neutral, the same as if the record had ended in ?all. The specification says it is better to end with redirect or all so the stop is explicit.
The protocol does not require a receiver to reject, folder, or accept any particular result. Handling is discussed later in the RFC, and each operator chooses a policy. A pass is evidence of authorization. It is not a promise that the message is wanted.
What is an SPF record in DNS?
The record is a single string in the RDATA of one DNS TXT record, type 16, and multiple SPF records for the same owner name are not permitted. The character content is US-ASCII. An older dedicated SPF record type existed in the experimental phase, and RFC 7208 drops it, so you publish TXT only.
Google’s Workspace instructions describe the record as a line of text you add at your domain provider. Their example is v=spf1 include:_spf.google.com ~all. Receiving servers check that line to see whether the message came from an authorized server.
A record starts with the version v=spf1. A string such as v=spf10 does not match version 1 and is discarded. The RFC’s own example is v=spf1 +mx a:colo.example.com/28 -all, published at the domain itself, not under an extra subdomain.
| Piece | What it does | DNS lookup at check time |
|---|---|---|
| all, ip4, ip6 | Match every host, or a literal address | No |
| a, mx, include, exists | Ask DNS, then match | Yes, and they count toward 10 |
| ptr | Reverse lookup, discouraged by the limit rules | Yes, counts toward 10 |
| redirect | After mechanisms, continue at another domain | Yes, counts toward 10 |
| exp | Explanation string, looked up later | Not part of the 10 |
One TXT record may hold several quoted strings. They are concatenated with no space added. That is how a record can pass the 255-octet cap on a single character-string. The whole answer should still fit in 512 octets, the size RFC 7208 says ought to avoid an old DNS limit.
What do the qualifier and the result mean?
The qualifier is optional and defaults to +. The four marks map straight onto results.
+returns pass. The client is authorized to inject mail with that identity.-returns fail. The client is not authorized to use the domain in that identity.~returns softfail. The domain says the host is probably not authorized, and it has not published a stronger fail.?returns neutral. The domain states that it is not asserting either way.
Two more results are errors, not policy. Temperror means a transient problem, generally DNS, and a later retry may succeed. Permerror means the published record cannot be interpreted. Someone has to change the DNS.
None is the result when no usable domain name was extracted, or when no SPF record was retrieved. It is not the same as neutral. Neutral means a record was evaluated and declined to assert. None means there was nothing to evaluate.
Cloudflare’s email records page describes SPF as the list of IP addresses and domains authorized to send on behalf of the domain. The same page lists DKIM and DMARC beside it. Those are separate records. SPF does not sign the body, and it does not set the receiver’s disposition.
Why does the 10-lookup limit exist?
Some terms cause DNS queries when they are evaluated, and some do not. The terms that do are include, a, mx, ptr, exists, and the redirect modifier. Implementations must limit the total number of those terms to 10 during one evaluation, and past 10 the result is permerror, so one check cannot fan out across DNS without a bound.
all, ip4, and ip6 do not cause a lookup at evaluation time, so they do not spend the budget. The exp modifier looks up an explanation later, and it is also outside this limit.
The mx mechanism has a second cap: evaluating each MX record must not query more than 10 address records, A or AAAA, and past that mx returns permerror. For ptr, address records past the first 10 are ignored rather than failing the whole check. The RFC explains the difference, because the domain owner controls MX, while the IP owner controls PTR.
Void lookups, answers that are empty or a name error, should be limited to two. A time limit, if the receiver sets one, should allow at least 20 seconds before returning temperror. Those are ceilings in the specification, not a suggestion to add more lookups.
Chaining many include mechanisms is the usual way a real record hits the wall. Each include spends the budget, and the included record’s own lookups count in the same global limit. A record that only lists ip4 and ends in -all spends none of the 10.
Where does a QR code sit relative to SPF?
A QR code that opens a mail draft never publishes an SPF record and never runs a check.
The email QR code generator builds a code that opens a draft. That is a convenience on a printed page or a screen. The receiving server still evaluates whatever TXT record the domain has published, using the envelope identity of the message that is eventually sent. The code does not add a host to the authorized set.
Mail moves through the same naming system as the rest of the internet. The SPF record is one TXT string at the domain, and the check is a left-to-right walk with a hard cap of 10 DNS-looking terms. Pass, fail, softfail, and neutral are policy results, while temperror and permerror mean the check itself could not finish cleanly.
Frequently asked questions
What is an SPF record in email?
It is a line of DNS text that lists servers allowed to send mail for a domain. A receiving server reads it during the SMTP conversation and compares the connecting IP address with that list. The check uses the envelope identity, the MAIL FROM address, and the specification also recommends a separate check of the HELO name. It does not read the From line inside the message body, and it does not prove the message text is unchanged.
Can a domain publish two SPF records?
No. RFC 7208 says a domain name must not have multiple records that would make an authorization check select more than one record. Two TXT records that both start with v=spf1 are an error, not a merger. If a record is too long for one 255-octet character string, you may publish several quoted strings inside the same TXT record. Those strings are joined with no added space.
What does softfail mean?
Softfail is the result of a matching mechanism marked with a tilde. The publishing domain is saying the host is probably not authorized, without the stronger fail that a hyphen produces. Google's Workspace example ends in ~all, which is that weaker ending. A hyphen before all is an explicit fail for everyone else. The specification does not require a receiver to reject mail on either result.
What is permerror?
Permerror means the published records could not be interpreted, and someone has to fix the DNS. Crossing the limit of 10 DNS-looking terms returns permerror. So does crossing the recommended cap of two void lookups, meaning queries that come back empty or as a name error. A temporary DNS failure is different. That one is temperror, and a later retry may succeed without a DNS edit.
Does SPF replace DKIM or DMARC?
No. Cloudflare's email-record page lists the three as separate records. SPF lists who may send. DKIM checks a cryptographic signature so the content was not altered in transit. DMARC tells receivers what to do when SPF or DKIM fails, and it can send you reports. Publishing only an SPF record leaves those other checks unset. This guide does not invent a required order for adding them.
Sources
- Sender Policy Framework (SPF) · RFC Editor, 2014
- Set up SPF · Google Workspace Help, 2026
- Set up SPF to identify valid email sources · Microsoft Learn, 2026
- Email records · Cloudflare, 2026