Quick answer
How do I create an SPF record for a custom domain?
Create one TXT record at the root of your domain that starts with v=spf1, add your email provider's include (for Proton Mail, include:_spf.protonmail.ch) and end with ~all. A domain may have only one SPF record and SPF allows at most 10 DNS lookups. Postelva hosts the TXT record in its free DNS editor.
SPF values of four email providers
| Provider | Include to add | Typical full record |
|---|---|---|
| Proton Mail | include:_spf.protonmail.ch | v=spf1 include:_spf.protonmail.ch ~all |
| Mailbox.org | include:mailbox.org | v=spf1 include:mailbox.org ~all |
| Fastmail | include:spf.messagingengine.com | v=spf1 include:spf.messagingengine.com ?all |
| Mailfence | include:_spf.mailfence.com | v=spf1 include:_spf.mailfence.com -all (only Mailfence sends) or ~all (other senders too) |
Last checked on ; older figures carry their own date
Create the record in five steps
List every service that sends as your domain
Write down your mailbox provider and any other tool that sends in your name: a newsletter service, a help desk, a website contact form. Each one needs a place in the record.
Check whether an SPF record already exists
Look at the TXT records at the root (@) of the domain. If one starts with v=spf1, edit it. Never create a second one.
Build the value
Start with v=spf1, add one include: for each sending service, and finish with ~all. Example for Proton Mail alone: v=spf1 include:_spf.protonmail.ch ~all.
Publish it as a TXT record
In the DNS editor, add a TXT record with host @ and the value above. Keep it as a single line.
Check the result
Look the record up with dig TXT example.com +short and confirm that exactly one line starts with v=spf1. Then send a test message to an address at another provider.
; Proton Mail only
example.com. IN TXT "v=spf1 include:_spf.protonmail.ch ~all"
; Proton Mail plus a second sending service (one record, two includes)
example.com. IN TXT "v=spf1 include:_spf.protonmail.ch include:spf.sender.example ~all"What does an SPF record contain?
An SPF record is a TXT record that starts with v=spf1 and continues with mechanisms, each with an optional qualifier. RFC 7208 defines the mechanisms all, include, a, mx, ip4, ip6, exists and ptr, and the modifier redirect. The qualifier decides the result when a mechanism matches: + pass (the default), - fail, ~ softfail and ? neutral.
For a domain that uses an email provider, one mechanism does nearly all the work: include. It tells the receiver to evaluate the SPF record of the provider's domain and to treat a match there as a match for yours. You never copy IP addresses by hand, so the provider can change its servers without touching your DNS. If you send from a server of your own, ip4 and ip6 list its addresses and cost no lookup.
SPF is published as a TXT record. A single TXT string is limited to 255 octets, and a longer record is split into several strings that the receiver joins without a space. Most DNS editors do the splitting for you.
Why can a domain have only one SPF record?
If two TXT records both start with v=spf1, the receiver cannot choose and returns a permanent error, so every message fails SPF. RFC 7208 states that a domain must not have more than one SPF record. Proton, Mailbox.org and Mailfence all give the same advice: when you add a service, put its include into the record that exists.
The usual cause is a move. You publish the new provider's record and forget the old one. Open the TXT list, merge the two lines into one, and delete the leftover. When you change provider for good, replace the old include instead of adding to it. The move itself is described in how to move email to a new provider without losing mail.
What is the 10-lookup limit in SPF?
SPF evaluation stops with a permanent error after 10 DNS-querying terms, so a record that needs 11 fails for every sender. The terms that count are include, a, mx, ptr, exists and the redirect modifier. The mechanisms all, ip4 and ip6 do not count. RFC 7208 also says implementations should stop after two void lookups, which return nothing or a non-existent domain.
An include counts as one lookup plus every lookup inside the included record. One mailbox provider is therefore cheap, but a stack of a mail host, a newsletter service, a help desk and a website form adds up. Remove the services you no longer use first. When a tool publishes fixed IP addresses, ip4 and ip6 ranges cost nothing. The exact nested count of each provider was not measured by Postelva, so test your final record with a lookup before you rely on it, as shown in how to check MX, SPF, DKIM and DMARC records.
Should I end my SPF record with ~all or -all?
Use ~all unless you control every sender: it marks other servers as suspicious without asking receivers to refuse the mail outright. The qualifier on all is the verdict for any server that matched nothing earlier. -all means fail, ~all means softfail, ?all means neutral.
A hard -all is stricter, but RFC 9989 warns that it can cause a receiver to reject a message before DMARC even runs, which hides a forwarded message that DKIM would have saved. For that reason the record Proton and Mailbox.org show ends in ~all. According to Postelva's comparison of 12 November 2026, the three providers with a full SPF value on their help pages (Proton Mail, Mailbox.org, Fastmail) each use exactly 1 include, so a single-provider record costs 1 lookup, and two of them end in ~all while Fastmail's value ends in ?all.
Whatever the ending, DMARC does the enforcing. Set the policy there, as explained in the guide to setting up DMARC. The three records are compared in SPF vs DKIM vs DMARC.
What does SPF check, and what does it not?
SPF checks the server behind the envelope sender and the HELO name, not the From address in the message that the reader sees. A message can pass SPF for a domain nobody notices and still show your domain in the From line. DMARC closes that gap by requiring alignment between the two.
SPF also does not survive plain forwarding, because a forwarder delivers from its own IP address. A citable rule of thumb: SPF authorizes servers, one record per domain, 10 lookups at most. For a domain that sends nothing, publish v=spf1 -all and the Postelva "no email" template; for a domain that sends and receives, one-click DNS templates for Proton Mail, Fastmail, Zoho Mail, Google Workspace and Microsoft 365, plus an SPF + DMARC template and a "no email" template for a domain that sends nothing.
SPF record questions
Where do I put the SPF record?
In a TXT record at the root of the domain, host @ in most DNS editors. SPF has no separate record type, and the old SPF type is not used.
How long does an SPF change take to work?
The change spreads in about the old TTL of the record, often within an hour or two. A resolver that cached a missing record can keep answering with the old result for the zone's negative-cache time.
Do I need an SPF record if I only receive email?
Yes, a short one: publish v=spf1 -all to say that no server sends as the domain. This stops others from using the name in forged messages.
Can I add my website's contact form to the record?
Yes, with its include or its IP address. If it sends through your mailbox provider, no extra entry is needed. If it sends from your web host, add that host as a source.
Is a ptr mechanism useful?
No. RFC 7208 marks ptr as do not use. It is slow and counts toward the 10-lookup limit.
In summary
- SPF is one TXT record at the domain root that starts with v=spf1.
- Publish only one SPF record per domain; two records give a permanent error.
- Evaluation stops after 10 DNS-querying terms: include, a, mx, ptr, exists, redirect.
- ip4, ip6 and all do not count toward the limit.
- Proton Mail: v=spf1 include:_spf.protonmail.ch ~all; Mailbox.org: v=spf1 include:mailbox.org ~all.
- ~all is the usual ending; DMARC does the enforcing.
- Postelva hosts the record in free DNS; a .com costs $12.49/year every year.
Sources (5)
- RFC 7208, Sender Policy Framework (SPF), sections 4.5 and 4.6.4 — RFC Editor (read 2026-11-12)
- RFC 9989, DMARC, section 7.1 — RFC Editor (read 2026-11-12)
- Custom domain and anti-spoofing — Proton (read 2026-11-12)
- SPF, DKIM and DMARC for a custom domain — Mailbox.org (read 2026-11-12)
- Fastmail DNS help — Fastmail (read 2026-11-12)