Hardening · 10 July 2026 · 5 min read
SPF, DKIM and DMARC: stop fake emails sent in your company's name
Three DNS records stop fake invoices and phishing sent "from" your domain. A step-by-step guide for Microsoft 365 and Google Workspace, with verification at the end.
ClearSecurity Vision
Anyone can send an email that appears to come from [email protected] — the email protocol doesn’t verify the sender by default. That is exactly what one of the most damaging scams relies on: the invoice with a changed bank account, sent “from you” to your own customers.
The defence has existed for years and is free: three DNS records — SPF, DKIM and DMARC — that tell mail servers around the world who is allowed to send on behalf of your domain and what to do with everything else. A far-from-small bonus: your legitimate email lands in Spam less often, and the big providers (Gmail, Yahoo) already require these records from senders.
What you need
- Access to your domain’s DNS management (at the registrar, or Cloudflare if the domain lives there)
- The list of services that send email on your domain’s behalf: your email platform (Microsoft 365 or Google Workspace), but also the newsletter tool, the CRM, the invoicing software — they all count
- An hour now, plus a few minutes per week during the monitoring period
Step 1: SPF — who is allowed to send
SPF is a TXT record on the root domain listing the servers authorised to send email for you.
- Open your DNS management and look for the TXT record starting with
v=spf1. There must be exactly one — two SPF records make SPF invalid. - If there isn’t one, create it. For Microsoft 365:
v=spf1 include:spf.protection.outlook.com ~allFor Google Workspace:v=spf1 include:_spf.google.com ~all - For every additional service that sends email in your name, add the
includefrom that service’s documentation to the same record (for examplev=spf1 include:spf.protection.outlook.com include:your-newsletter-service.com ~all).
The trailing ~all means “anything not on the list is suspect”. There is also the stricter -all (“reject outright”) — move to it only after the DMARC reports below confirm you’ve caught every legitimate service.
Step 2: DKIM — the signature that can’t be forged
DKIM cryptographically signs every outgoing email, and the receiving server verifies the signature against a key published in your DNS.
On Microsoft 365:
- Open security.microsoft.com → Email & collaboration → Policies & rules → Threat policies → Email authentication settings → DKIM.
- Select your domain. The portal shows you two CNAME records (
selector1._domainkeyandselector2._domainkey) — publish them in DNS exactly as displayed. - Once DNS has propagated (minutes to a few hours), come back and flip Sign messages for this domain with DKIM signatures on.
On Google Workspace:
- In admin.google.com → Apps → Google Workspace → Gmail → Authenticate email, generate the key (choose 2048-bit).
- Publish the TXT record shown (on the name
google._domainkey) in DNS, then press Start authentication.
Third-party services (newsletter, invoicing) each have their own “authenticate your domain” page — enable DKIM there too, otherwise their emails will fail the DMARC check.
Step 3: DMARC — the policy and the reports
DMARC ties it all together: it tells servers what to do when an email fails SPF and DKIM, and sends you reports about who is sending email in your name.
- Create a TXT record on the name
_dmarcwith the value:v=DMARC1; p=none; rua=mailto:[email protected] p=nonemeans “monitor only” — nothing gets blocked yet. Leave it for 2–4 weeks and read the reports arriving at theruaaddress: you’ll see which legitimate services you missed in steps 1–2.- When the reports look clean, raise the policy to
p=quarantine(fake emails go to Spam), and after another quiet period, top=reject(they are refused outright). Onlyp=rejecttruly stops the fake invoice.
Verify the result
- Send an email from your domain to a Gmail address. Open it, click the three-dot menu → Show original: SPF, DKIM and DMARC should all show PASS.
- Check the records directly:
nslookup -type=TXT your-company.comandnslookup -type=TXT _dmarc.your-company.com(in any terminal). - Repeat the test from point 1 for the newsletter and any other service sending in your name.
Common mistakes
- Two SPF records. The standard allows exactly one; a second invalidates both. New services get added with
include:inside the existing record. p=rejecton day one. Without the monitoring period, you block your own newsletter or the invoices from your ERP. The 2–4 weeks of patience are part of the recipe.- DMARC reports nobody reads. The
ruaaddress must exist and someone must look at it — that’s where you spot both the attacks and the forgotten legitimate services. - DKIM enabled only on the main platform. The newsletter and invoicing tools also send “as you” — each needs its own setup.
For broader context on phishing — the most common way fake emails end up costing money — see how to spot a phishing attack.
Under NIS2? Protecting email communications falls under the law’s cyber-hygiene and communications-security measures.
One step done. See the full picture.
Answer a few questions across the 8 essential areas — from passwords and backups to suppliers — and get a report by email with your weak spots and next steps.
Start the self-assessment →
newsletter
Get new articles by email.
NIS2 compliance, incident reporting and plain-language security — only when we publish something new. No spam, unsubscribe anytime.