Skip to content
Cybersecurity

SPF

SPF (Sender Policy Framework) is an email authentication method that verifies which servers are authorized to send email for a given domain. SPF uses a DNS TXT record listing authorized IP addresses, enabling spam and spoofing detection.

SPF Definition

SPF (Sender Policy Framework) is the simplest email authentication mechanism that defines which mail servers are authorized to send email on behalf of a domain. SPF uses DNS TXT records where the domain owner lists authorized IP addresses and servers.

How Does SPF Work?

  1. Email sent from IP address X
  2. Recipient server checks sender domain SPF record
  3. DNS lookup - retrieving SPF record
  4. IP verification - is address X on the list?
  5. Result - pass, fail, softfail, neutral

SPF Record

Example:

example.com TXT "v=spf1 ip4:192.168.1.0/24 include:_spf.google.com -all"
  • v=spf1: SPF version
  • ip4: Authorized IP addresses
  • include: Include another domain’s SPF
  • a: Domain A records
  • mx: Domain MX records
  • -all: Reject all others (hard fail)
  • ~all: Soft fail
  • ?all: Neutral

SPF Results

ResultMeaningAction
PassIP authorizedAccept
Fail (-all)IP unauthorizedReject
SoftFail (~all)IP probably unauthorizedMark as suspicious
Neutral (?all)No informationAccept

SPF Limitations

  • 10 DNS lookup limit: Include/a/mx count toward limit
  • Forwarding breaks SPF: Forwarded messages have different IP
  • No integrity: SPF doesn’t verify message content
  • Header vs envelope: SPF checks envelope, not From header

SPF Best Practices

  • Minimal record: Only necessary entries
  • -all over ~all: Strong policy
  • SPF flattening: For complex configurations
  • Regular audits: Remove unused entries
  • DMARC combination: SPF alone is insufficient

SPF vs DKIM vs DMARC

AspectSPFDKIMDMARC
What it checksIPSignatureSPF + DKIM
ConfigurationDNS TXTDNS + serverDNS TXT
ComplexityLowMediumMedium
ForwardingBreaksWorksDepends

SPF Implementation

  1. Audit: All legitimate email sources
  2. Record creation: List IPs and includes
  3. Testing: Use SPF validators
  4. Publish: Add TXT record in DNS
  5. Monitoring: Track failures

SPF is the first layer of email authentication protection - simple to implement but should always be combined with DKIM and DMARC.

Explore our services

Want to Reduce IT Risk and Costs?

Book a free consultation - we respond within 24h

Response in 24h Free quote No obligations