Guide Guides
SPF, DKIM and DMARC step by step: how to stop criminals sending email as your domain
The fake invoice “from a supplier” or the urgent request “from the CEO” often arrives from an address that looks exactly like yours. Three DNS records – SPF, DKIM and DMARC – let receivers spot a forged sender, but they only work together and only when set up properly. In May 2026 a new version of the DMARC standard (RFC 9989) was published, and it retires some familiar tags. This guide explains what each record does, how to roll them out without losing legitimate mail, and how to check the result.
Key points
- SPF lists the servers allowed to send for a domain, DKIM signs the message, and DMARC ties both to the From address the recipient actually sees. Only DMARC with a quarantine or reject policy stops spoofing.
- Evaluating SPF may trigger at most 10 DNS lookups (include, a, mx, ptr, exists, redirect). Go over and the result is permerror – a common failure for domains using lots of cloud services.
- The new DMARC standard (RFC 9989, May 2026) drops the pct, rf and ri tags, adds t (testing), np and psd, and finds the organizational domain by walking the DNS tree instead of using the Public Suffix List.
- The rollout: SPF and DKIM for every service that sends on your behalf, DMARC p=none with reports, at least a month of review, then quarantine, then reject. Lock down domains that never send mail straight away.
Why it matters
SMTP, designed in 1982, does nothing to verify who is sending a message. The sender writes the From address themselves, much like a return address on an envelope. A large share of the scams we cover at Kyberkit relies on exactly that: invoice fraud with changed bank details, urgent payment requests “from the boss”, or sextortion emails that claim to come from the victim's own address.
Three DNS records let receivers recognise a forgery and throw it away. Unlike user training, they cost next to nothing – just care during rollout. And the big mailbox providers now expect them. Since 1 February 2024, Google has required everyone sending to Gmail addresses to use SPF or DKIM, and bulk senders (more than 5,000 messages a day) to use all three. Since 5 May 2025, Microsoft has been routing mail from high-volume senders to Outlook.com that don't meet its requirements to Junk, and says it will start rejecting it later.
What each record does
| Record | What it checks | Where in DNS | Weakness on its own |
|---|---|---|---|
| SPF (RFC 7208) | which IP addresses may send mail with the domain in the envelope (MAIL FROM) or HELO | TXT on the domain, e.g. example.com |
ignores the From line, breaks on forwarding |
| DKIM (RFC 6376, 8301) | a cryptographic signature by domain d= |
TXT at selector._domainkey.example.com |
anyone can sign with their own domain |
| DMARC (RFC 9989) | that SPF or DKIM passed for the From domain (alignment), and what to do if not | TXT at _dmarc.example.com |
has nothing to evaluate without SPF/DKIM |
The key idea is alignment. A fraudster can buy invoices-supplier.top, set up SPF and DKIM for it and pass both checks – while putting accounts@yourcompany.com in the From line. Only DMARC asks whether the authenticated domain belongs to the From domain. It doesn't, so the receiver applies your policy.
Step 1: List everything that sends mail as you
The most common cause of trouble after switching DMARC on is a forgotten service. Go through it with colleagues and check your invoices:
- your main mail (Microsoft 365, Google Workspace, your own server),
- newsletters and marketing,
- billing, your online shop and payment gateway,
- helpdesk, CRM, booking system,
- printers and scanners, monitoring, website forms,
- suppliers who send in your name.
For each one, note whether it can DKIM-sign with your domain (its own selector) and which domain it uses in the envelope. The service's documentation will tell you how.
Step 2: SPF – one record, and watch the limit
A domain may have only one record starting with v=spf1. An example for Microsoft 365 plus one marketing service:
example.com. TXT "v=spf1 include:spf.protection.outlook.com include:_spf.marketing-service.example ~all"
What to watch for, per RFC 7208:
- The 10-lookup limit. The
include,a,mx,ptrandexistsmechanisms and theredirectmodifier all count – including those inside included records. Exceed it and the receiver must return permerror, which leaves SPF for your domain effectively broken. Remove includes you don't need and never useptr. - Void lookups. Implementations should also fail after two lookups that return nothing (a non-existent domain in an
include). Clear out includes for services you've stopped using. -allvs~all.-allgives a fail result,~allonly a softfail, and RFC 7208 says receivers shouldn't reject mail on softfail alone. With DMARC at p=reject, DMARC decides, so~allis fine during rollout.
SPF also has a built-in limit: when a message is forwarded (say, a rule that forwards to a personal address), it arrives from someone else's server and SPF fails. That's why you need DKIM as well.
Step 3: DKIM – 2048-bit keys, signed with your domain
Each service turns DKIM on separately: it generates a key and gives you a record (often a CNAME) for selector._domainkey.yourdomain. Per RFC 8301:
- RSA keys must be at least 1024 bits, and 2048 is recommended; Google requires at least 1024 bits for delivery to Gmail and recommends 2048,
rsa-sha1must no longer be used for signing or verifying.
For DMARC, what matters is that the service signs with your domain (d=yourcompany.com or a subdomain), not its own. A default signature with the provider's domain won't help DMARC. Plan key rotation: add a new selector, switch signing over, then delete the old record a few days later.
Step 4: DMARC – monitor first, enforce later
Start in monitoring mode with aggregate reports:
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
Receivers that support reporting (Gmail, for example) will send you XML reports showing which IP addresses sent mail using your domain and whether it passed SPF, DKIM and alignment. The reports are unreadable by hand, so use a report analyzer (open source or a service). You're looking for two things: legitimate sources that fail (fix their SPF/DKIM) and unknown sources abusing your domain.
For domains heading to p=reject, RFC 9989 suggests at least a month at p=none, then the same again at p=quarantine (suspicious mail goes to spam) while comparing results, and only then p=reject. A domain at p=reject shouldn't rely on SPF alone and must apply valid DKIM signatures. Domains whose users post to mailing lists should not publish p=reject, according to the standard – lists modify messages and the signature then fails.
The final record might look like this:
_dmarc.example.com. TXT "v=DMARC1; p=reject; sp=reject; np=reject; rua=mailto:dmarc-reports@example.com"
What changed in the new DMARC (RFC 9989)
In May 2026 DMARC was published as an IETF Standards Track document for the first time. RFC 9989 replaces the original RFC 7489 from 2015 as well as RFC 9091, while reporting now lives in separate documents: RFC 9990 (aggregate) and RFC 9991 (failure). The changes that matter to admins:
| Change | What it means in practice |
|---|---|
pct removed |
no more percentage rollouts; pct=0 becomes t=y, pct=100 is the default |
new t tag |
t=y = testing mode: receivers don't apply the policy, only any special handling of their own (such as rewriting From); the default is t=n |
new np tag |
policy for non-existent subdomains – fraudsters love inventing invoices.yourcompany.com |
new psd tag |
flags public suffix domains (mainly relevant to TLD operators) |
rf and ri removed |
you can no longer set the failure report format or the aggregate report interval |
| DNS tree walk instead of the Public Suffix List | receivers find the organizational domain by querying _dmarc at higher levels (at most 8 queries); large organisations can publish policy at several points in their tree |
Old records with pct=100 do no harm, but write new ones without pct, rf and ri. Don't assume every receiver supports the new version yet – for testing, p=none is safer than t=y.
Step 5: Lock down domains that never send mail
Every domain you own – including ones registered only to protect your brand or catch typos – can be abused as a sender. If it never sends mail, three records are enough:
parked.example. TXT "v=spf1 -all"
_dmarc.parked.example. TXT "v=DMARC1; p=reject; sp=reject"
parked.example. MX 0 .
The last line is a so-called null MX (RFC 7505): it announces that the domain accepts no mail. There's no reason to wait with these domains – you have no legitimate mail to lose.
Step 6: Check the result
You can check the records from the command line:
dig +short TXT example.com | grep spf1
dig +short TXT _dmarc.example.com
dig +short TXT selector1._domainkey.example.com
Before and after publishing, paste the record values into our SPF, DMARC and DKIM record checker – it counts DNS lookups and flags removed tags and short DKIM keys, without sending anything anywhere.
Then send a test message to a mailbox at another provider (Gmail, Outlook.com), open its source and paste the headers into our Email Header Analyzer. The Authentication-Results header should show spf=pass, dkim=pass and dmarc=pass, and the From domain should match the authenticated domain. The UK's NCSC also offers a free email security check for your domain.
Checklist
- A list of every service that sends in your name.
- One SPF record, no more than 10 DNS lookups, no
ptrand no dead includes. - 2048-bit DKIM with your domain on every service, and a key rotation plan.
- DMARC
p=nonewithrua, reports reviewed regularly. - After at least a month,
p=quarantine, thenp=reject, plusnp=rejectagainst invented subdomains. - Parked domains:
v=spf1 -all, DMARCp=reject, null MX. - Records free of the retired
pct,rfandritags.
Does this matter for small businesses and councils too?
Yes – arguably most of all. Invoice fraud hits hardest where nobody owns email or DNS and nobody phones to confirm a change of bank details: small firms, charities and local councils. DMARC at p=reject won't stop a fraudster who registers a lookalike domain (yourcompany-uk.com) – for that, use our Link Checker and a rule that bank detail changes are always verified through another channel. But it does shut down the cheapest trick of all: sending a forgery straight from your own address.
FAQ
Isn't SPF enough?
No. SPF checks the envelope sender (MAIL FROM), not the From address the recipient sees. A criminal can pass SPF using their own domain in the envelope and put yours in the From line. DMARC is what requires the domain authenticated by SPF or DKIM to match the domain in From.
Should my SPF record end in -all or ~all?
Under RFC 7208, -all means the server is not authorized (fail), while ~all only means it probably isn't (softfail), and receivers should not reject mail on softfail alone. Once you have DMARC at p=reject, DMARC makes the call and the difference matters less. For a domain that sends no mail at all, use -all.
Will p=reject make me lose legitimate email?
It can, if you've missed a service that sends on your behalf – a newsletter tool, billing, helpdesk or CRM. That is why RFC 9989 suggests at least a month at p=none with reports and the same again at p=quarantine. Mailing lists that modify messages also cause failures, and the standard advises domains whose users post to lists not to publish p=reject.
What should I do about the old pct tag in my DMARC record?
RFC 9989 removed pct. A value of pct=0 maps to the new t=y (testing mode), and pct=100 is the same as leaving the tag out. Not every receiver will support the new version yet, though, so for real testing p=none is safer than relying on t=y.
How can I tell whether an email I received passed SPF, DKIM and DMARC?
Open the message source (“Show original”) in your mail client and paste the headers into our Email Header Analyzer. It shows the results from the Authentication-Results header and whether the From domain matches the authenticated one. The headers never leave your browser.
Sources
- RFC 9989 – Domain-based Message Authentication, Reporting, and Conformance (DMARC) (May 2026)
- RFC 7208 – Sender Policy Framework (SPF)
- RFC 8301 – Cryptographic Algorithm and Key Usage Update to DKIM
- RFC Editor – RFC 7489 (status: obsoleted by RFC 9989, 9990 and 9991)
- Google – Email sender guidelines
- Microsoft Defender for Office 365 Blog – Outlook’s New Requirements for High-Volume Senders (2 April 2025)
- RFC 7505 – A "Null MX" No Service Resource Record for Domains That Accept No Mail
- NCSC UK – Email security and anti-spoofing
Spotted a mistake? Let us know and we will correct it openly.