Glossary
EMAIL AUTH

SPF

Sender Policy Framework — a DNS TXT record that lists which mail servers are authorized to send email for a domain. Receiving servers check the sender's IP against this list.

SPF (Sender Policy Framework) is a DNS-based email authentication mechanism. It lets domain owners publish a list of IP addresses and services authorized to send email on their behalf. Receiving mail servers check the sending IP against this list when processing inbound mail.

DNS Record Format

example.com.  TXT  "v=spf1 ip4:203.0.113.0/24 include:_spf.google.com ~all"

Mechanisms

MechanismExampleMatches
ip4:ip4:203.0.113.0/24IPv4 address or CIDR range
include:include:_spf.google.comAll IPs in another domain’s SPF
mxmxDomain’s mail server IPs
all~all / -allCatch-all (always last)

All Qualifier

  • ~all (SoftFail): flag but deliver
  • -all (Fail): reject unauthorized senders
  • ?all (Neutral): no policy — useless for security

Key Limitation

SPF checks the envelope sender (MAIL FROM / Return-Path), not the From: header users see. Attackers can pass SPF while forging the visible From: address. DMARC alignment is required to tie SPF results to the From: header.

10-Lookup Limit

RFC 7208 limits SPF evaluation to 10 DNS lookups. Exceeding this causes a PermError. Use ip4:/ip6: instead of include: chains where possible.