Toolbox · Download
Email Security: SPF, DKIM and DMARC in Five Steps
Rollout plan from the inventory to p=reject, based on RFC 7208, RFC 6376 and the DMARC standard RFC 9989
With SPF, DKIM and DMARC, you prove that emails using your domain really come from you and tell recipients how to handle forgeries. This plan takes you in five steps from the inventory to the p=reject policy, with sample DNS entries and the pitfalls described in the standards. It takes into account the DMARC standard RFC 9989 published in May 2026.
Contents
What checks what
| Method | What it checks | DNS entry | Standard |
|---|---|---|---|
| SPF | whether the sending server is authorized to send for the domain in the envelope sender (MAIL FROM) or in the HELO, not the visible sender address | TXT at the domain, starts with v=spf1 | RFC 7208 |
| DKIM | whether the message is unchanged and comes from the signing domain (d=) | TXT under <selector>._domainkey.<domain> | RFC 6376, updated by RFC 8301 |
| DMARC | whether the visible sender domain (From) matches a domain verified by SPF or DKIM (alignment); plus policy and reports | TXT under _dmarc.<domain>, starts with v=DMARC1 | RFC 9989 (obsoletes RFC 7489), reports RFC 9990 |
SPF alone says nothing about the visible sender address (RFC 7208, Section 11.2). Only DMARC links them: a message passes DMARC if at least one domain verified by SPF or DKIM aligns with the sender domain (RFC 9989, Section 5.3.5).
Step 1: Record all senders
Record every service that sends emails with your domain as the sender. Every legitimate sender will later need a passing SPF or DKIM result with an aligned domain; gaps must be closed before you publish a strict policy (RFC 9989, Section 5.1.6).
- Your own mail server or Microsoft 365 or Exchange Online
- Newsletter and marketing services
- CRM, ticket system, web shop and accounting (invoice delivery)
- Devices and applications that send via SMTP, such as scanners, monitoring and web forms
- Service providers that send on your behalf
- Domains and subdomains that do not send any email at all
Step 2: Publish SPF
; Microsoft 365 and your own server (192.0.2.25 is an example address)
example.com. IN TXT "v=spf1 ip4:192.0.2.25 include:spf.protection.outlook.com -all"
; Name under which no email is sent
www.example.com. IN TXT "v=spf1 -all"- Exactly one SPF entry per domain: multiple entries with
v=spf1result in a permanent error (permerror, RFC 7208, Section 4.5). - No more than 10 DNS lookups caused by
include,a,mx,ptr,existsandredirectduring the entire evaluation, otherwise permerror (Section 4.6.4). The entries of included service providers count too. - Do not use
ptr(Section 5.5). -all(fail) explicitly declares servers not listed as unauthorized,~all(softfail) is only a weak statement; recipients should not reject on the basis of softfail alone (Sections 2.6.4, 2.6.5 and 8.5).- Names that do not send email publish
v=spf1 -all(Section 10.1.2). - A TXT string holds no more than 255 characters. Longer entries are split into several strings, which the recipient concatenates without spaces (Section 3.3).
Step 3: DKIM for every sender
Each sender signs with its own key. You publish the public key as a TXT entry under <selector>._domainkey.<domain>; the selector (s=) and domain (d=) appear in the signature of every message (RFC 6376, Sections 3.5 and 3.6.2.1).
mail2026._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…"- Sign only with
rsa-sha256;rsa-sha1must not be used for signing or verifying (RFC 8301, Section 3.1). - Keys of at least 1024 bits, 2048 bits recommended (RFC 8301, Section 3.2).
- Microsoft 365: DKIM is set up via two CNAME entries
selector1._domainkeyandselector2._domainkey;Get-DkimSigningConfigshows the exact targets. When created via PowerShell, 1024 bits is the default;Rotate-DkimSigningConfig -KeySize 2048switches to 2048 bits. - DKIM signatures usually survive forwarding, SPF does not. Anyone who publishes p=reject therefore must not rely on SPF alone and must sign validly with DKIM (RFC 9989, Section 7.4).
Step 4: DMARC in monitoring mode
_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-berichte@example.com"p=noneexpresses no preference for handling failures (monitoring mode). Withrua, you receive aggregate reports on all servers that send with your domain (RFC 9989, Sections 5.1.4 and 5.1.5).- The reports are intended for automated processing; use an analysis tool or service (Section 5.1.5).
- If the report mailbox is in a different domain, that domain must consent, for example with a TXT entry
example.com._report._dmarc.example.netcontainingv=DMARC1(RFC 9990). - Failure reports (
ruf) contain content from individual messages; most recipients do not send them for privacy reasons (RFC 9989, Section 10.2). Aggregate reports remain the recommended means (RFC 9991). - Every legitimate sender without aligned SPF or DKIM is fixed before a strict policy applies (RFC 9989, Section 5.1.6).
Step 5: Via quarantine to reject
- p=none
Monitor
v=DMARC1; p=none; rua=mailto:…– At least one month. - p=quarantine
Quarantine
v=DMARC1; p=quarantine; rua=mailto:…– Just as long; compare the results with the monitoring phase. - p=reject
Reject
v=DMARC1; p=reject; rua=mailto:…– Permanently, once all legitimate senders pass.
t=ymarks a policy in testing: recipients apply one level less, so forp=rejectonly quarantine (RFC 9989, tag t). The formerpcttag no longer exists since RFC 9989; older guides, including Microsoft’s, still mention it.- Subdomains:
spapplies to existing subdomains,npto non-existent ones; if both are missing,papplies (RFC 9989, tags sp and np). - Mailing lists: according to RFC 9989, domains whose users post to mailing lists on the internet should not publish p=reject; anyone who does so anyway should inform users that participation in mailing lists may be impaired (Section 7.4).
parked.example.com. IN TXT "v=spf1 -all"
_dmarc.parked.example.com. IN TXT "v=DMARC1; p=reject;"
parked.example.com. IN MX 0 .The null MX entry MX 0 . states that the domain does not accept email; there must be no other MX entry alongside it, and domains used as senders should not publish it (RFC 7505). For unused domains, Microsoft recommends DMARC entries stating that no email may ever come from them, and no DKIM entries.
At a glance
- All senders are recorded, including external services and devices.
- Exactly one SPF entry, no more than 10 DNS lookups, ending with
-allor~all. - DKIM for every sender with
rsa-sha256and a 2048-bit key. - DMARC with
p=noneandrua; the reports are evaluated. - All legitimate senders pass DMARC with an aligned domain.
p=quarantine, thenp=reject; mailing lists are taken into account.- Domains without email traffic are secured with SPF, DMARC and null MX.
Sources
- RFC 7208: Sender Policy Framework (SPF) — Sections 2.6, 3.3, 4.5, 4.6.4, 5.5, 8.5, 10.1.2, 11.2
https://www.rfc-editor.org/rfc/rfc7208 - RFC 6376: DomainKeys Identified Mail (DKIM) Signatures — Sections 3.5, 3.6.1, 3.6.2.1
https://www.rfc-editor.org/rfc/rfc6376 - RFC 8301: Cryptographic Algorithm and Key Usage Update to DKIM — Sections 3.1 and 3.2
https://www.rfc-editor.org/rfc/rfc8301 - RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance (DMARC) — Standards Track, May 2026, obsoletes RFC 7489
https://www.rfc-editor.org/rfc/rfc9989 - RFC 9990: DMARC Aggregate Reporting
https://www.rfc-editor.org/rfc/rfc9990 - RFC 9991: DMARC Failure Reporting
https://www.rfc-editor.org/rfc/rfc9991 - RFC 7489: DMARC (previous version, Informational, March 2015)
https://www.rfc-editor.org/rfc/rfc7489 - RFC 7505: A "Null MX" No Service Resource Record
https://www.rfc-editor.org/rfc/rfc7505 - Microsoft Learn: Set up DKIM for Microsoft 365
https://learn.microsoft.com/defender-office-365/email-authentication-dkim-configure - Microsoft Learn: Set up DMARC for Microsoft 365
https://learn.microsoft.com/defender-office-365/email-authentication-dmarc-configure - Microsoft Learn: Set up SPF for Microsoft 365
https://learn.microsoft.com/defender-office-365/email-authentication-spf-configure