Use this when listing which servers may send mail for your domain.
SPF (Shortest Path First)
receiving server → SPF record → sender IP allowed?
Context & applicabilityCommon mistakes · platform/version boundaries
- More than 10 DNS lookups (
include,a,mx,redirect) →permerror, SPF fails. - Two SPF records on the same name →
permerror. +allor?all, which authorise everyone.- Forgetting third-party senders (CRM, newsletter, ticketing).
- Expecting SPF to protect the visible From header — it checks the envelope sender; DMARC ties them together.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
dig TXT <domain> +short | grep v=spf1— SPF record- SPF lookup count (≤ 10) — limit
- SPF result in message headers (Received-SPF) — evaluation
ReferenceWhy it matters1 section · depth on demand
Writing SPF records
example.com. TXT "v=spf1 ip4:203.0.113.25 include:spf.protection.outlook.com include:_spf.google.com -all"
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
SPF (Sender Policy Framework) publishes in DNS which servers may send email for a domain. Receivers check the connecting server's IP against the SPF record of the envelope sender (Return-Path) domain.
example.com. TXT "v=spf1 include:spf.protection.outlook.com include:_spf.mailprovider.example ip4:203.0.113.25 -all"
Documented example, not captured output.
| Qualifier | Meaning |
|---|---|
-all | Fail everything else (recommended once complete) |
~all | Soft fail |
?all | Neutral — no protection |
Limits: a maximum of 10 DNS lookups per evaluation (exceeding it causes permerror), and SPF checks the envelope sender, not the visible From address — DMARC provides that alignment. Inventory every service sending as your domain before tightening the record.
Mechanisms
| Mechanism | Example | Note |
|---|---|---|
ip4 / ip6 | ip4:203.0.113.0/24 | No DNS lookup |
include | include:spf.protection.outlook.com | Counts toward 10 lookups |
a / mx | mx | Lookups |
-all | Fail everything else | |
~all | Soft fail (common during rollout) |
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Email Security → SPF. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc7489 · confidence 94%