Set up SPF, DKIM and DMARC: stop email spoofing
In short
- SPF defines which servers may send email for your domain.
- DKIM signs every email cryptographically so receivers can verify it was not altered.
- DMARC tells receivers what to do with email failing SPF/DKIM – and sends you reports.
- Goal: SPF ending in
-allor~all, DKIM enabled, DMARC withp=quarantineorp=reject.
Without these records anyone can send email that appears to come from your domain – ideal for phishing and CEO fraud. Since 2024, large mailbox providers such as Gmail and Yahoo require SPF, DKIM and DMARC from bulk senders; without them legitimate email lands in spam more often.
1. SPF: who may send?
example.com. TXT "v=spf1 include:spf.protection.outlook.com include:servers.mcsv.net -all"
include:adds your provider's SPF rules;ip4:/ip6:allow single servers or networks;mxallows your own mail servers.- End with
-all(reject everything else) or~all(mark as suspicious). Never+all.
Common SPF mistakes
- Multiple SPF records: only one
v=spf1record is allowed – otherwise SPF is invalid. - More than 10 DNS lookups: every
include,a,mx,existsandredirectcounts, including nested ones. PHPCheck.net counts them for you. - Forgotten senders: contact forms, shop systems, accounting software or CRMs often send email on behalf of the domain.
2. DKIM: digital signature
Enable DKIM at your email provider; it gives you a DNS record with the public key under <selector>._domainkey.example.com
(Microsoft 365: selector1/selector2, Google Workspace: google). The selector in use appears in the
DKIM-Signature: … s= header of a sent email. Use keys of at least 2048 bits.
3. DMARC: policy and reports
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
p=– policy:none(monitor),quarantine(spam folder),reject.rua=– address for aggregate reports showing who sends in your name.
Roadmap to p=reject
- Set up SPF and DKIM for all senders, publish DMARC with
p=noneandrua. - Review reports for 2–4 weeks and add missing senders.
- Move to
p=quarantine(optionally withpct=25first), then top=reject.
Domains that send no email
example.com. TXT "v=spf1 -all"
_dmarc.example.com. TXT "v=DMARC1; p=reject;"
example.com. MX 0 . ; "null MX" (RFC 7505)
Check
Enter your domain at PHPCheck.net – the "Email" section shows SPF (incl. lookup count), DMARC policy, DKIM selectors, MTA-STS and TLS-RPT at a glance.