SPF Record Explained: How to Write One Correctly

What an SPF record is, how to read and write one, the 10-lookup limit, ~all vs -all, and common mistakes that break email delivery.

Yrzo AI28 November 2026 2 min read

What SPF does

Sender Policy Framework (SPF) is a DNS TXT record that lists which mail servers are allowed to send email for your domain. Receiving servers check it to decide whether an email claiming to be from you came from an approved source. It is one of three records — with DKIM and DMARC — that stop email spoofing.

Reading an SPF record

A typical record for a business using Microsoft 365 and a newsletter tool:

v=spf1 include:spf.protection.outlook.com include:servers.mcsv.net ~all

  • v=spf1 — identifies the record as SPF
  • include: — authorises another provider's list of servers
  • ip4: / ip6: — authorises a specific IP address or range
  • ~all — soft fail: mail from anywhere else is suspicious
  • -all — hard fail: mail from anywhere else should be rejected

Writing yours

  1. List every service that sends email as your domain: mailboxes, website forms, shop, CRM, newsletters, invoicing, helpdesk.
  2. Find each provider's SPF include value in their help documentation.
  3. Combine them into one record ending in ~all (while testing) or -all (when confident).
  4. Publish it as a single TXT record on your root domain.

Rules that trip people up

Only one SPF record

Two TXT records starting v=spf1 makes SPF fail entirely. Merge them into one.

Is your site exposed to this?

Run a free, non-intrusive check of what attackers can see from outside. No account needed.

The 10 DNS lookup limit

Each include, a, mx and redirect costs a DNS lookup, and includes can contain more includes. More than 10 in total causes a permanent error. Remove services you no longer use, and replace includes with ip4 ranges where a provider allows it.

SPF checks the hidden sender, not the visible one

SPF validates the envelope sender, not the "From" address people see. That is why you need DMARC to protect the visible address.

Forwarding breaks SPF

Forwarded mail comes from the forwarder's server and fails SPF. DKIM survives forwarding, which is another reason to have both.

~all or -all?

Use ~all while you confirm every sender is listed, then move to -all. With DMARC at p=reject, the difference matters less, because DMARC makes the final call.

Domains that never send email

Publish v=spf1 -all on parked domains so nobody can send as them.

Check your record

Yrzo AI reads your SPF record, flags syntax errors and lookup-limit problems, and checks DMARC alongside it. Run a free scan.

Related reading: DKIM Explained: How Email Signing Works and How to Enable It · How to Set Up DMARC: A Step-by-Step Guide for UK Businesses · Website Blacklisted? How to Check and Get Removed

SPF record explainedhow to create SPF recordSPF record exampleSPF too many DNS lookups
Share

Check your own website in 60 seconds

Free check, no account needed. Want the full picture? Full reports start at £149, with up to 110 checks with a 14-day money-back guarantee.

Keep reading