Guide
Email Authentication: SPF, DKIM, DMARC
Without authentication, anyone can send mail that claims to be from your domain. The
three records work together: SPF lists who may send, DKIM proves a message was not
altered, and DMARC tells receivers what to do when SPF or DKIM fails, and sends you
reports. This guide sets them up for Exchange Online. DNS examples use
example.co.uk.
SPF: a DNS TXT record listing the servers allowed to send for your domain.
DKIM: a cryptographic signature added to each message, verified against a public key in DNS.
DMARC: a policy saying what to do with mail that fails SPF or DKIM, plus a reporting address.
Step 1
Publish SPF
Add one TXT record at the domain root authorising Exchange Online. Use only one SPF record per domain; multiple records break SPF.
Type: TXT
Host: @ (example.co.uk)
Value: v=spf1 include:spf.protection.outlook.com -all
-all (hard fail): mail from anywhere else fails SPF. Use this once you are sure all legitimate senders are included.
~all (soft fail): a safer starting point if you have third-party senders to add first.
Add other senders inside the same record with more include: terms, for example a marketing platform, rather than creating a second SPF record.
nslookup -type=txt example.co.uk
Step 2
Enable DKIM
Exchange Online publishes two CNAME records that point at Microsoft's rotating keys, then you switch signing on. In the Microsoft 365 Defender portal go to Email & collaboration > Policies & rules > Threat policies > Email authentication settings > DKIM, select the domain, and it shows the two CNAMEs to publish.
Host: selector1._domainkey -> selector1-example-co-uk._domainkey.example.onmicrosoft.com
Host: selector2._domainkey -> selector2-example-co-uk._domainkey.example.onmicrosoft.com
After the CNAMEs resolve, return to the DKIM page and switch "Sign messages for this domain" to Enabled.
Two selectors let Microsoft rotate keys without a signing gap.
Step 3
Publish DMARC
Add a TXT record at _dmarc. Start in monitor mode so you can see the
reports before enforcing.
Type: TXT
Host: _dmarc (_dmarc.example.co.uk)
Value: v=DMARC1; p=none; rua=mailto:dmarc@example.co.uk; fo=1
p=none: monitor only. Receivers report but take no action. Start here.
p=quarantine: failing mail goes to junk. Move here once reports show your legitimate mail passes.
p=reject: failing mail is dropped. The end goal, once you are confident.
rua: the mailbox that receives the aggregate XML reports.
Step 4
Verify
Send a message to an external mailbox and read the headers, or use a checker. In the
received message look at the Authentication-Results header.
Authentication-Results: spf=pass ... dkim=pass ... dmarc=pass
All three pass: the records are correct and signing is on.
dkim=none: signing is not enabled yet, or the CNAMEs have not propagated.
spf=fail for your own mail: a legitimate sender is missing from the SPF record.
Step 5
Tighten the Policy
Leave DMARC at p=none for a week or two and read the reports. Confirm every
legitimate sending source passes SPF or DKIM, add any that are missing, then move the
policy to p=quarantine, and finally p=reject. Move SPF to
-all at the same confidence point.
Why It Matters
Security Angle
SPF, DKIM, and DMARC together are the control that stops attackers spoofing your domain
in phishing and business email compromise. SPF or DKIM alone can be worked around;
DMARC at p=reject is what actually blocks spoofed mail and gives you
visibility through its reports. It is also a required control under Cyber Essentials and
a common audit finding. Roll it out from monitor to enforce so you tighten security
without dropping legitimate mail on day one.