An SPF record is a TXT record on your domain that lists the servers allowed to send mail for it. Receivers compare the server that delivered a message with that list. A typical record:
example.com. TXT "v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.25 ~all"
Step by step
- List every service that sends mail with your domain as envelope sender: your mailbox provider, your website or webshop, invoicing, CRM, helpdesk, scanners. Forgetting one is the most common mistake.
- Look up the SPF value for each. Providers document an
include:(likeinclude:spf.protection.outlook.comfor Microsoft 365). For your own servers useip4:orip6:. - Combine them into one record starting with
v=spf1and ending with~allor-all. See which ending to use. - Publish it as a TXT record on the domain itself (the "@" or empty name in most DNS panels). Replace the old record; never add a second one.
Rules receivers enforce
- One record per domain. Two records make SPF fail for everything.
- At most 10 DNS lookups. Every
include,a,mx,existsandredirectcounts, including the ones inside included records. See too many DNS lookups. - End with
all. Without it, unlisted servers get a neutral result, which protects nothing. Anything afterallis ignored. - Don't use
ptr. It is deprecated, slow, and some receivers ignore it. redirect=only works withoutall. If the record has both, the redirect is ignored.
Only mail from subdomains?
SPF is checked for the domain in the envelope sender (Return-Path), not the visible From address. Many email platforms use
their own bounce domain, or a subdomain of yours such as bounce.example.com. In that case the SPF record belongs
on that subdomain, and you don't need their include in your main record at all. For DMARC, DKIM is often what makes
their mail pass.