An SPF record is a line of text in your domain’s DNS listing the servers that are allowed to send email using your domain name. When a message arrives claiming to come from you, the receiving provider looks the record up and checks whether the server that delivered it is on the list. If it is not, the message is treated with suspicion, and your own quotes and invoices can end up in spam for a reason nobody in the office can see.
In short
- A published list of who may send mail for your domain.
- One record per domain, kept in DNS as a TXT record.
- Every service that sends mail as you has to be on it.
- It works alongside DKIM and DMARC, never instead of them.
What the record says
An SPF record is short, and each part of it does one job. A business on
Microsoft 365 with nothing else sending mail would publish something like
v=spf1 include:spf.protection.outlook.com ~all, and most records are longer
versions of the same pattern.
- The version tag. Every record starts with
v=spf1, which marks it as SPF. - Include entries. Each one hands part of the list to a provider, which publishes and maintains its own servers. Mailbox providers, newsletter platforms and online shops each supply one.
- Address entries. Written as ip4 or ip6, they name individual servers, used when the business runs a mail server of its own.
- The ending. It tells receivers what to do with every server that is not on the list.
The receiving server works through the record from left to right and stops at the first entry that matches. The order rarely matters for a small business, but the completeness of the list always does.
Where it breaks
Most SPF faults come from a business adding services over the years without anybody owning the record.
- Two records. A new service’s instructions say add an SPF record, somebody adds a second one, and every message now fails, because a domain may have only one.
- A service left out. The contact form, the booking system, the shop’s order emails or the invoicing software sends mail as you, and nobody added it. Those messages fail while ordinary email works, which makes the fault hard to spot.
- Too many lookups. The standard allows ten DNS lookups while a record is checked, and every include counts towards them. A record that grows past the limit fails for everybody, although each entry in it is correct.
- Old entries left behind. A provider the business stopped using years ago is still on the list, and is still allowed to send mail as you.
Soft fail, hard fail and the ending
The last entry decides how strictly the list is meant to be applied. The tilde
ending, ~all, is a soft fail: mail from an unlisted server is accepted but
counted against the message. The minus ending, -all, is a hard fail: the
domain says such mail should be refused. A question mark says nothing useful,
and a plus sign allows any server on the internet to send as you, which defeats
the purpose of having a record at all.
Many receiving providers now weigh the SPF result together with DKIM and DMARC rather than obeying the ending on its own, so the choice matters less than it once did. Start with the soft version while you find every service that sends as you, and tighten it once the DMARC reports show nothing legitimate failing.
What SPF does not cover
SPF has two gaps, and both are the reason it never stands alone.
- It checks the wrong address for a reader. SPF looks at the return address used for bounces, which the reader never sees, rather than the From address shown in the inbox. A message can pass SPF for one domain while displaying another, which is the gap DMARC closes by requiring the two to match.
- Forwarding breaks it. When a message is forwarded, the forwarding server delivers it, and that server is not on your list. DKIM survives forwarding, because its signature travels inside the message itself.
This is why the large mailbox providers ask bulk senders for all three records, and why a domain with SPF alone can still see its mail sorted into spam, as described under email deliverability.
Checking and changing yours
Look up the record before you change it, and change it in one place only.
- List every sender. The mailbox provider, the newsletter platform, website forms, the shop, and any booking or invoicing software that emails customers.
- Read the current record. A free DNS lookup tool shows it, or ask whoever manages your DNS records.
- Merge, then count. Put every service into a single record, then count the lookups it needs.
- Test each system. Send a message from each one and read the headers, which show whether SPF passed.
Make the change where your DNS is actually managed, which after a website move is not always where the domain was bought. Changes spread as cached copies expire, so a failing test in the first hour does not always mean the record is wrong.
Words you will hear
- Sender Policy Framework. The full name of the standard.
- Include. An entry that pulls in a provider’s own list of servers.
- Soft fail. Mail from an unlisted server is accepted but marked down.
- Hard fail. Mail from an unlisted server should be refused.
- Return path. The hidden bounce address that SPF actually checks.
- Permerror. The result when a record is broken, for example by being duplicated or by needing more than ten lookups.
Find out how many systems send email as your business before anybody touches the record. The list is almost always longer than the record, and the missing entry is usually the one sending your invoices.
Questions we get
More about spf record
What does SPF stand for?
Where does the SPF record live?
Can a domain have two SPF records?
What is the ten lookup limit?
What is the difference between ~all and -all?
Is SPF enough on its own?
Do we need SPF if we only send a few emails a day?
Related terms
DMARC
DMARC is a DNS record telling mail providers what to do with messages that fail SPF and DKIM for your domain, and where to send reports about who is sending.
DNS records
DNS records are the settings telling the internet where to find your website and your email, which is why one wrong line can take both offline at once.
Email deliverability
Deliverability is whether your email reaches the inbox or the spam folder. It is decided by your sending reputation, not by how well the email is written.