This chapter helps you understand an existing record, assess additional sending services and investigate errors such as multiple SPF records or too many DNS lookups.
What SPF checks and where its limits lie
SPF stands for Sender Policy Framework. A receiving mail server can use it to check whether its SMTP peer's IP address is authorised for the SMTP sender domain in use. The relevant identities are MAIL FROM and HELO or EHLO. The visible From: in the message header is a different identity. SPF alone therefore does not confirm the address your mail client displays as the sender.
For an empty SMTP reverse path, such as MAIL FROM:<>, SPF uses an identity derived from the HELO domain. A domain check without the SMTP connection does not know this particular context. The distinction is described in RFC 7208, sections 2.3–2.5.
On narrow screens, scroll the table sideways.
| Principle | What it means for your check |
|---|---|
| SMTP identity | Check the domain actually used in MAIL FROM; assess a HELO check separately. |
| No more than ten DNS-triggering terms | The limit applies to the SPF evaluation path followed, including nested references. |
| One SPF record per queried name | Several matching v=spf1 records are an error. Several character strings within one TXT record are a different matter. |
A DNS check can show the published SPF record, identifiable references and certain configuration errors. Without the sending IP address and SMTP sender, it does not establish that a particular message passes SPF. A missing record must also be distinguished from a temporarily failed DNS query.
SPF does not encrypt a message, inspect its content or confirm a person's identity. DMARC adds the connection between successful authentication and the visible sender domain. DKIM offers a second possible path through a signature.
How an SPF check works
The recipient determines the connecting IP address and SMTP identity, then queries the corresponding SPF record. After checking syntax, it evaluates mechanisms from left to right. The first matching mechanism determines the result. An error can also end evaluation earlier. If no mechanism matches, an existing redirect decides the outcome; without that reference, the default result is Neutral.
Schematic explanation · not a measurement
What an SPF check compares
- A server with the example IP address
203.0.113.10connects and usesMAIL FROM:<info@example.com>. - The recipient looks up the SPF TXT record for
example.com. - It evaluates the record's mechanisms for this IP address and SMTP identity; further DNS queries may be needed.
- The result may be
Pass,Failor an error. The recipient decides what happens to the message using its complete set of receiving rules.
Example IP address and reserved domain; not a recorded mail transaction. The visible From: address is a different identity.
Without SPF, this domain has no published SPF authorisation. Recipients can still accept messages and examine them using DKIM, DMARC or other methods. SPF can express which servers are authorised and which are not. This makes sending routes traceable; it guarantees neither a harmless message nor its acceptance.
On narrow screens, scroll the table sideways.
| SPF result | Meaning |
|---|---|
Pass | The IP address is authorised for the identity checked. |
Fail | The policy declares the IP address unauthorised for this identity. |
Softfail | The policy suspects an unauthorised sender but makes a weaker statement than Fail. |
Neutral | The policy makes no statement about authorisation. |
None | Possible reasons include no matching SPF record or no usable domain from the SMTP identity. |
TempError | A temporary problem prevented the check, typically involving DNS. |
PermError | The policy could not be evaluated correctly, for example because of syntax errors, multiple SPF records or an exceeded limit. |
These results and their limits are defined in RFC 7208, section 2.6. A Pass does not promise inbox placement. A Fail alone is likewise not a universal instruction to reject the message.
Read an SPF record: mechanisms, include and redirect
An SPF record starts with v=spf1, followed by mechanisms and, where applicable, modifiers. The syntax of the entire record is checked before evaluation begins. An error in a later part does not become valid because an earlier mechanism might match.
On narrow screens, scroll the table sideways.
| Element | Example | Meaning | Counts towards the limit of ten? |
|---|---|---|---|
ip4 | ip4:203.0.113.0/24 | Compares the connecting IP address with an IPv4 address or network. | No |
ip6 | ip6:2001:db8::/32 | Equivalent comparison for IPv6. | No |
a | a:mail.example.com | Uses the appropriate address records for the specified name. | Yes |
mx | mx | Uses the addresses of the mail servers identified by MX records. | Yes |
include | include:_spf.google.com | Evaluates another SPF policy and matches if it returns Pass. | Yes |
exists | exists:%{i}.%{d}._spf.example.com | After macro expansion, checks whether the queried A response contains an address. | Yes |
redirect | redirect=_spf.example.com | Takes the result of evaluating another policy if no mechanism matches. | Yes, when evaluated |
The IP networks shown and domains containing example are documentation examples. Even a real provider name in the table is not a recommendation to add its include to your domain without checking. Use only the values specified by the responsible sending service for your route.
include adds an evaluation path
With include, such as include:sender.example, a Pass from the target policy makes this mechanism match. With the usual positive qualifier, the calling record also returns Pass. If the target returns Fail, Softfail or Neutral, include does not match and evaluation continues in the calling record. An error in the target may end evaluation, however. A target without an SPF record produces PermError when the include is reached.
So include does not copy a line of text into your record. The recipient evaluates another policy, and its DNS-triggering terms count towards the shared limit. The exact mapping of results is in RFC 7208, section 5.2.
redirect delegates the remaining evaluation
A valid SPF record may consist solely of the version and redirect:
v=spf1 redirect=policy.exampleIf the reference is reached, SPF adopts the target policy's result. If no SPF record exists there, the result is PermError; a temporary DNS error must be treated as such. A local include is not a prerequisite for this delegation.
redirect is a modifier and need not appear at the end of the text. It may occur only once. If the record contains an all mechanism, redirect is ignored regardless of its position. An earlier match can also prevent an otherwise present reference from being evaluated at all. RFC 7208, sections 5.1 and 6.1
What -all, ~all, ?all and +all mean
The qualifier before a mechanism determines the SPF result when it matches. If omitted, + applies. Because all always matches, it is usually used as the final mechanism.
On narrow screens, scroll the table sideways.
| Ending | Result for IP addresses not matched earlier | Interpretation |
|---|---|---|
-all | Fail | The policy declares these IP addresses unauthorised. |
~all | Softfail | A weaker statement that these IP addresses are probably unauthorised. |
?all | Neutral | No statement about authorisation. |
+all | Pass | All IP addresses not matched earlier are authorised. |
all is not syntactically required. But without a matching mechanism or redirect, the result is Neutral. Whether -all suits your complete sender list or you initially use ~all must reflect the actual configuration; neither form guarantees acceptance or rejection by the recipient.
Too many DNS lookups: what the limit actually counts
The often cited limit of ten concerns DNS-triggering SPF terms, not ten visible include words or ten DNS packets. It counts evaluated include, a, mx, ptr, exists and redirect terms, including nested evaluation. ip4, ip6 and all do not count. The version string v=spf1 does not use one of these places either. DNSSEC and DANE queries are outside this SPF term budget.
If an eleventh such term is needed, SPF evaluation must return PermError. If a mechanism matches earlier, the remaining path is not followed. The actual load therefore depends on the IP address and identity examined. A static overview of all branches is useful, but is not complete evidence for every possible message.
Additional limits also apply:
- MX resolution: Further limits apply to the addresses looked up. Exceeding the MX address limit described in RFC 7208 produces
PermError. - PTR and
%{p}: The addresses to be validated are limited here too. Further results beyond the limit are ignored; this does not imply the same blanket error rule as for MX. The standard advises againstptrin new SPF records. - Empty answers: For void lookups — DNS queries with no matching answer or with
NXDOMAIN— the standard recommends a limit of two. It may be configurable; exceeding the applied limit producesPermError.
The distinct rules are in RFC 7208, section 4.6.4. Do not collapse them into a single general “DNS limit” during diagnosis.
Three ways to investigate an overly complex record
Review the sender list. Match each authorised service to a sending route actually used. Remove entries only after establishing their use. A forgotten newsletter service and an unused old authorisation are different cases.
Separate sending routes onto subdomains. A dedicated sending subdomain can separate policies if the service actually uses that domain in MAIL FROM. Merely publishing another SPF record under a new name does not change the sending route. Afterwards, check the necessary DMARC alignment with the visible From: domain.
Use flattening only with ongoing maintenance. Replacing provider references with IP networks can reduce DNS-triggering terms. A list copied once may become outdated or incompletely represent a dynamic policy. Anyone using this method takes responsibility for maintaining the authorised addresses. Macros also require the specific evaluation context; a domain check cannot conclusively check every possible expansion. They do not bypass the limit. If sender data needed for expansion is missing, that part of the evaluation cannot be assessed conclusively. This establishes neither a DNS outage nor a complete SPF pass.
Check an existing SPF record
- Identify the sending route: Which application sends, which IP address connects to the recipient, and which domain appears in SMTP
MAIL FROM? Do not confuse this with the visible sender address. - Look up the DNS record: Query TXT for this domain. The following command is a read example, not a measurement performed here:
dig TXT example.com- Count matching records: There must be only one SPF record for this query. Other TXT records may coexist. Related character strings within one TXT record are joined without additional spaces.
- Examine syntax and references: Check qualifiers, provider values,
includetargets andredirect. Distinguish a missing record from DNS errors and investigate the lookup path relevant to your sending route. - Assess the message separately: An actual SPF result needs connection data or a finding from a trusted receiving system. An arbitrary
Authentication-Resultsheader with uncertain provenance is not reliable evidence. The section on header findings explains this diagnostic approach.
The Email Security Check can inspect publicly accessible configuration features of your domain. A finding may suffice for initial clarification. When a delegation is resolved, distinguish the original record from the effective target policy. The domain check does not replace evidence that each of your sending services correctly authenticates a particular message.
Document SPF: technical measures and legal context
Record which sending services you authorise, who maintains their DNS entries and what needs checking when changes are made. SPF can then form part of traceable technical protection. A published record does not establish the complete effectiveness of your safeguards or compliance with a law.
The following references concern this guide's existing German and EU context; they do not establish general requirements for other countries:
- Germany: section 30 BSIG requires appropriate and proportionate risk management measures from entities in scope. It does not establish a blanket SPF obligation for every domain.
- European Union: Article 32 GDPR concerns a level of protection appropriate to the risk when processing personal data. SPF does not encrypt content or prevent misuse of an already compromised authorised account.
- Technical profiles and contracts: Requirements such as BSI TR-03182 on email authentication need separate consideration. A particular SPF result or
-alldoes not prove conformity. Additional contractual requirements must also be distinguished from SPF protocol syntax.
To assess possible attacks, see the sections on email spoofing and phishing. SPF offers limited protection against domain misuse; it is not general protection against every forged or harmful email.
A guide for your sending service
Choose the available guide for the service that actually sends for your domain. The chapters explain different configuration paths; their existence does not confirm your domain's configuration.
Frequently asked questions
What is SPF?
SPF is a policy published in DNS for authorised sending servers. A recipient compares the connecting IP address with the policy for the SMTP identity. This alone does not confirm the visible From: address.
Why are only ten DNS lookups allowed?
The limit bounds the DNS load of an SPF evaluation. It counts certain evaluated mechanisms and redirect, including nested policies. It concerns neither just the number of visible include entries nor all DNS packets. Exceeding the limit of ten produces PermError.
What is the difference between -all and ~all?
-all produces Fail for IP addresses not authorised earlier; ~all produces the weaker Softfail. Recipients should not reject a message solely because of Softfail. This is not an acceptance guarantee; other receiving rules remain relevant. Both values must reflect the sending routes actually used. RFC 7208, section 8.5
Is SPF enough to prevent sender forgery?
No. SPF checks an SMTP identity, not the visible sender domain alone. DMARC can connect a successful SPF path with that domain; alternatively, a successful aligned DKIM signature is sufficient. Even DMARC does not prevent arbitrary display names, lookalike domains or harmful content.
Why can SPF fail when mail is forwarded?
The next recipient sees the forwarder's IP address. This is often absent from the original SPF policy. SRS can rewrite the SMTP sender for forwarding, allowing an SPF pass for the new SMTP sender. It does not automatically establish SPF alignment with the original visible sender domain. A preserved aligned DKIM signature can still provide the DMARC pass path.
How do I check my SPF record?
Start with the SMTP sender domain actually used and its TXT query, such as dig TXT example.com. Check the number of records, syntax, qualifiers and references. The domain check can inspect this DNS configuration; a particular message's result also needs actual connection data or trusted receiving findings.
Sources and next steps
The technical basis is RFC 7208, with updates RFC 7372, RFC 8553 and RFC 8616. Sources checked for this chapter: 12 September 2026. The RFC 7208 errata were checked for relevance to the statements covered. No example on this page is presented as an actual sending or DNS test performed here.
Previous chapter: MX infrastructure. Next chapter: DKIM. For context: email security overview.