An SPF record lists the servers authorised to send email for a domain. Receiving mail servers can check it to help identify messages sent from unauthorised sources.

Before you change SPF

List every service that sends email for the domain, including your mail provider, website and any third-party sending service. Obtain each provider’s current SPF instructions.

SPF checks the domain used in the message’s return address, which can differ from the address displayed in the From field. SPF alone does not prevent every form of spoofing or guarantee delivery; DKIM and DMARC provide additional checks.

Add or update the record

  1. Open DNS management at the provider hosting the domain’s authoritative DNS zone. This may differ from the domain registrar.
  2. Find any TXT record beginning with v=spf1 at the name you need to configure.
  3. Update that record, or create a TXT record if none exists. Use the root-domain name, often entered as @, or the specific subdomain given by your mail provider.
  4. Combine the authorised sending sources into one SPF record for that name. Do not create a separate SPF record for each provider.
  5. Save the change, leaving unrelated TXT records such as DKIM and DMARC in place.

For example, this record authorises one IPv4 address:

v=spf1 ip4:192.0.2.10 -all

192.0.2.10 is a documentation address. Replace it with the actual sending server’s address; do not publish this example unchanged. Provider instructions may instead supply an include: entry.

-all marks other sources as failing SPF; ~all marks them as a soft failure. The receiving server decides how to handle the result. Check that all legitimate senders are included before applying a strict policy.

Check the result

Allow cached DNS answers to expire, then send test messages from each legitimate sending service. Check the receiving system’s authentication results for SPF.

SPF limits the DNS lookups caused by mechanisms such as include, including nested lookups, to ten. Adding too many services can therefore break the check. Revisit the record whenever sending services change.