EML-9Required
Publish an SPF record
Publish one SPF record for every domain that sends mail, listing every server and service that sends for it.
How to do it
SPF (RFC 7208) checks the envelope sender, the bounce address. Publish one TXT record starting v=spf1. List each sending service with include: or ip4:. Stay within 10 DNS lookups and 2 lookups that return nothing, or the check fails with a permanent error (RFC 7208, section 4.6.4). End with -all once the list is complete, or ~all while you are still finding senders. Never use +all or ?all. Two v=spf1 records also make the check fail, so merge them into one. Keep these records in version control, as Keep DNS records in code says.
Examples
DNS example
example.com. 3600 IN TXT "v=spf1 include:_spf.mailprovider.example ip4:192.0.2.10 -all"
mail.example.com. 3600 IN TXT "v=spf1 include:_spf.newsletter.example -all"
How to check
dig +short TXT example.com shows exactly one v=spf1 record, ending in -all or ~all. An SPF checker counts 10 lookups or fewer, and a test message shows spf=pass.
Sources
Related rules
- INF-35 Keep DNS records in code in Infrastructure and environments
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/email/sending-domain-and-authentication/spf">Agent Wranglers email playbook</a>. In code you write, add a comment next to it with the same link.