SPF (Sender Policy Framework)
SPF (Sender Policy Framework) is an email authentication mechanism whose policy, published as a TXT record at the apex of a domain, lists the IP ranges and hosts that are permitted to send mail on behalf of that domain.
In plain English
If you only send mail from Google Workspace and SendGrid, you publish an SPF record saying so. Mail servers that receive a message claiming to be from your domain can then check the sender IP against your SPF policy and reject the message if the IP is not on the list.
How it works
SPF is defined in RFC 7208. The record is a TXT at the apex (or at a sending sub-domain) starting with v=spf1, followed by mechanisms (include:, ip4:, ip6:, a, mx, exists, ptr) and a final qualifier (-all, ~all, ?all, +all). Receivers compute the sending IP against this policy and return Pass, Fail, SoftFail, Neutral, None, PermError, or TempError. Two practical hazards: SPF only checks the SMTP MAIL FROM (envelope sender, not the visible From header), so it does not protect against display-name spoofing; and the ten-lookup limit can easily be exceeded when chaining include: for several SaaS senders. SPF is one of the three pillars of modern email authentication together with DKIM and DMARC, where DMARC aligns the visible From header to the SPF or DKIM result.
Related terms
- TXT record — SPF is published as TXT
- DKIM — partner authentication mechanism
- DMARC — uses SPF as one of its inputs
- MX record — receiving-side counterpart
- DNS — base protocol
- Authoritative DNS — publishes SPF
SecDNS perspective
The SecDNS authoritative editor lints SPF records, counts your DNS lookups, and warns before you ship a v=spf1 policy that will permerror at the receivers.