Mistakes to avoid when writing an SPF record
Most broken SPF records come from a handful of mistakes. Each one below comes with the message it produces and how to avoid it.
A second SPF record
Why. Adding a new provider by creating another v=spf1 record gives every receiver a permerror: multiple SPF records found.
Fix. Add the new include to the existing record. The generator always produces one record with everything in it.
A forgotten sender
Why. Invoices, website forms or a helpdesk that send with your address but are not listed get spf=softfail and land in spam once DMARC is enforced.
Fix. Tick every service that sends with your address. Your DMARC reports list every sender, including the ones nobody remembered.
Too many includes
Why. Past 10 DNS lookups, SPF returns permerror: too many DNS lookups for every message.
Fix. Remove old providers, use ip4 ranges where a provider documents fixed addresses, and move bulk mail to a subdomain with its own SPF record.
+all or ?all “to make it pass”
Why. +all lets any server on the internet send as your domain; ?all says nothing. Both remove the protection SPF exists for.
Fix. End with ~all with DMARC, or -all without it. Fix the missing senders instead.
a on shared hosting
Why. The a mechanism authorises the address of your website. On shared hosting, hundreds of other sites use that address, and all of them can then send as you.
Fix. Leave a unticked unless your website’s server is yours alone; list the mail service your site uses instead.