Master SPF (Sender Policy Framework) implementation to protect your domain from email spoofing and improve deliverability. Learn how to create, test, and maintain effective SPF records.
SPF (Sender Policy Framework) is an email authentication protocol that allows domain owners to specify which mail servers are authorized to send email on behalf of their domain.
Creating an effective SPF record requires careful planning and consideration of all authorized sending sources.
v=spf1 include:_spf.yourdomain.com include:sendgrid.net include:amazonses.com ~all
v=spf1
- Version identifier (always required)include:
- Authorized sending domains~all
- Soft fail for unauthorized sendersSPF has a 10 DNS lookup limit. Each include, a, mx, or ptr mechanism counts as one lookup. Plan your record carefully to avoid exceeding this limit.
Understanding SPF mechanisms is crucial for creating effective records.
ip4:
- Specify IPv4 addresses (e.g., ip4:192.168.0.1)ip6:
- Specify IPv6 addressesa:
- Use domain's A recordmx:
- Use domain's MX recordsinclude:
- Include another domain's SPF record+
- Pass (default)-
- Fail~
- Soft fail?
- Neutral# Basic record for a single mail server
v=spf1 ip4:192.168.0.1 ~all
# Record for multiple services
v=spf1 include:sendgrid.net include:amazonses.com include:_spf.google.com ~all
# Record with specific IP ranges
v=spf1 ip4:192.168.0.0/24 ip6:2001:db8::/32 ~all
Regular testing ensures your SPF record remains effective and properly configured.