SPF, DKIM and DMARC are three DNS-based checks that let a receiving mail server confirm a message really comes from the domain in its From address. SPF lists the servers allowed to send, DKIM signs each message, and DMARC requires one of them to match the visible From domain and sets what happens when none does.

This guide is for anyone who owns a domain and sends business email, and for the people who run it. It covers record syntax, setup order, a staged move from p=none to quarantine to reject, bulk-sender rules, forwarding and mailing lists, and troubleshooting. Everything is as of December 2026. In May 2026 the IETF published DMARC as RFC 9989, which obsoletes RFC 7489, so older advice about the pct tag is out of date.

What do SPF, DKIM and DMARC each do?

Email was designed without proof of who sent a message, so anyone can type any From address. SPF, DKIM and DMARC add that proof in three places, each published as a DNS record that receivers look up.

SPF, the Sender Policy Framework (RFC 7208), is a list in DNS of the servers allowed to send mail for a domain. The receiver checks the connecting server's IP address against the list for the domain of the envelope sender, also called the Return-Path address.

DKIM, DomainKeys Identified Mail (RFC 6376), is a signature on the message. The sender signs chosen headers and a hash of the body with a private key, and the receiver checks it against the public key in DNS. A valid signature shows that the signing domain handled the message and that the signed parts did not change.

DMARC, Domain-based Message Authentication, Reporting, and Conformance, ties the two to the address people see. A message passes when SPF or DKIM passes for a domain that matches the From domain. The record also tells receivers what to do with failures and where to send reports.

SPFDKIMDMARC
ChecksThe server's IP address against a listA signature against a public keyThat SPF or DKIM passed for the From domain
Domain usedEnvelope sender, or the HELO name if emptyThe d= domain in the signatureThe visible From domain
Published atThe domain itselfselector._domainkey.domain_dmarc.domain

None of the three is enough alone. Any domain owner can publish an SPF record and any domain can sign a message, so both can pass for a name unrelated to the From address (RFC 9989). Passing also does not mean the mail is wanted: spammers authenticate too, so authentication alone does not guarantee delivery. Our small business cybersecurity checklist places it among the other basics.

How do the three checks fit together, and what is alignment?

A message carries three domain names that can all differ. The From header domain is what the reader sees, and DMARC calls it the Author Domain. SPF checks the envelope sender domain, and DKIM verifies the signing domain in the d= tag.

DMARC passes when at least one of those checks passes and its domain matches the From domain. That match is alignment. Relaxed alignment, the default for both adkim and aspf, accepts any name under the same organizational domain. Strict alignment needs identical names.

An envelope carries a tag. A shield and a key each send a domain tag to a gate. One tag matches the envelope's tag, joined by an orange bracket; the other, a different shape, is turned away.
Fig. 1 DMARC passes only when the domain that SPF or DKIM validated matches the one in the From line.
Domain SPF or DKIM validatedFrom domainAlignment
foo.example.comnews.example.comRelaxed: same organizational domain
news.example.comnews.example.comStrict: identical
foo.example.netnews.example.comNone: different organizational domains

A third-party sender shows why alignment matters. A newsletter or invoicing service sends your mail with its own bounce domain and its own signing key. SPF and DKIM both pass, for the vendor, and neither aligns with you, so DMARC fails. The fix is a key published under your domain, through a DKIM record or a CNAME record the service gives you, as the Canadian Centre for Cyber Security describes, or a bounce subdomain of yours.

A receiver records its verdict in an Authentication-Results header (RFC 8601). This illustrative one shows that failure: both passes are for vendor.example, and DMARC fails for example.com.

Authentication-Results: mx.receiver.example;
  spf=pass smtp.mailfrom=bounce.vendor.example;
  dkim=pass header.d=vendor.example header.s=s1;
  dmarc=fail (p=QUARANTINE) header.from=example.com

How do you write an SPF record, and what is the 10-lookup limit?

An SPF record is one TXT record at the domain: v=spf1, the permitted senders as terms, and a default for everything else. This example uses a documentation address and a made-up service:

example.com.  IN  TXT  "v=spf1 include:_spf.google.com include:mail.newsletter.example ip4:203.0.113.25 ~all"

The receiver reads the terms left to right and stops at the first match. A term can carry a qualifier: + pass (the default), - fail, ~ softfail or ? neutral (RFC 7208). Here ip4: allows an address, include: trusts another domain's record, and all matches everything else, so it goes last.

Two rules prevent most breakage:

  • Publish one SPF record per name. If a query returns more than one, the result is a permanent error, permerror. Merge each new service into the existing record.
  • For a domain that sends no mail, publish v=spf1 -all, which RFC 7208 calls a well-established best practice.

Why does SPF fail with "too many DNS lookups"?

A check may follow at most 10 terms that cause DNS queries: include, a, mx, ptr, exists and redirect. The ip4, ip6 and all terms are free. Nested records count, so an include whose own record holds three more includes costs four. Past 10 the result is permerror. RFC 7208 also says to limit void lookups, queries that return no record, to two, so stale a and mx terms cause the same error. Because receivers stop at the first match, a record over the limit can still pass for some senders, which makes the failure intermittent.

A receiving server follows a chain of ten document cards. A solid orange bar stops the path after the tenth, and two dashed cards beyond it are never reached.
Fig. 2 Past 10 DNS lookups a receiver stops reading, and SPF returns a permanent error.

To get back under the limit, remove services you no longer use and move third-party senders to a subdomain, which has its own budget of 10. Swap an include for ip4 and ip6 terms only where the vendor publishes stable ranges, and note that Microsoft advises against flattening its own include because the addresses change often.

Should the record end in ~all or -all?

~all (softfail) says unlisted servers probably are not authorized. -all (fail) says they are not. Google recommends ~all, while Microsoft recommends -all for Microsoft 365 domains that also run DKIM and DMARC. RFC 9989 adds a caution: an SPF fail can reject a message early in the SMTP session, before DMARC runs, even when aligned DKIM would have passed, and mail rejected that way never appears in aggregate reports. Use ~all while you collect reports, and move to -all only once every sender is known and you accept that risk.

How does DKIM work, and how long should the key be?

A DKIM signature is a header the sending system adds before the message leaves. This one is illustrative, with the long values shortened:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=s2026;
  h=from:to:subject:date:message-id; bh=...; b=...

The d= tag names the signing domain and s= the selector. The h= tag lists the signed headers, which must include From, bh= is a hash of the body and b= is the signature (RFC 6376). The receiver joins s= and d= into a DNS name and reads the public key from the TXT record there:

s2026._domainkey.example.com.  IN  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
A sending server seals an envelope with a key. A lens at the receiving server checks the seal against a small orange key stored in a DNS database in a cloud above the path.
Fig. 3 The sender signs with a private key, and the receiver verifies with the public key in DNS.

The selector lets one domain publish several keys at once, one per sender or per rotation, and an empty p= marks a key as revoked.

Providers differ. Microsoft 365 asks for two CNAME records, selector1._domainkey and selector2._domainkey, and the second stays idle until the next rotation. Google Workspace generates a key for you to publish as a TXT record and allows up to 48 hours for it to work.

How long should a DKIM key be?

RFC 8301 sets the floor and the target. Signers must use RSA keys of at least 1024 bits and should use at least 2048 bits, and rsa-sha1 must not be used. Yahoo asks for at least 1024 bits. The Canadian Centre for Cyber Security recommends 2048-bit keys and accepts 1024 only for a device or service that cannot do better.

The practical snag is DNS. A single quoted string in a TXT record holds at most 255 characters, so a 2048-bit key goes in as two quoted strings back to back, as Google's troubleshooting page shows.

How often should you rotate DKIM keys?

The Canadian guidance advises rotating yearly: publish a new key under a new selector, switch the signer to it and delete the old record after a week. A dated selector such as s2026 is the reminder, and the yearly DNS review in our website maintenance guide is a good place to schedule it. Microsoft 365 takes 96 hours after a rotation request before the new key signs.

Anything that changes a signed header or the body after signing breaks the signature, and an outbound gateway that adds a footer to every message is one known cause.

What goes in a DMARC record in 2026?

A DMARC record is one TXT record at _dmarc under the domain. v=DMARC1 must come first, or the whole record is ignored, and if a query returns several records all are discarded. These are the tags most domains use, from RFC 9989:

TagPurposeNotes
pPolicy: none, quarantine or rejectIf absent, treated as p=none
sp, npPolicy for existing and non-existent subdomainssp defaults to p; np is new
ruaWhere aggregate reports gomailto: addresses
rufWhere failure reports goGmail does not support it
adkim, aspfAlignment: r relaxed or s strictBoth default to r
tt=y asks receivers to apply the policy one level lowerNew; default n
pct, rf, riSampling rate, failure format, report intervalHistoric; do not rely on them

The three rollout stages look like this, with a placeholder report mailbox:

; Stage 1: monitor
_dmarc.example.com.  IN  TXT  "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
; Stage 2: quarantine
_dmarc.example.com.  IN  TXT  "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"
; Stage 3: reject
_dmarc.example.com.  IN  TXT  "v=DMARC1; p=reject; sp=reject; rua=mailto:dmarc-reports@example.com"

If reports go to a mailbox on another domain, that domain must publish a TXT record v=DMARC1 at example.com._report._dmarc.reports.example.net, or receivers ignore the address (RFC 9990).

What changed with RFC 9989?

RFC 9989 replaced the original RFC 7489 and moved reporting into RFC 9990 (aggregate reports) and RFC 9991 (failure reports). Three changes matter to an ordinary domain. The pct tag is gone, because RFC 9989 says it was usually not applied accurately unless set to 0 or 100, and t takes over its testing use. The np tag covers subdomains that do not exist. And receivers find the policy and the organizational domain by a DNS tree walk of at most eight queries instead of the Public Suffix List. A record that still carries pct is not broken, but do not count on receivers applying it, even though Google's and Microsoft's rollout pages still show it.

How do you set up SPF, DKIM and DMARC step by step?

Do these in order. Reports come before enforcement because, as RFC 9989 puts it, in all but the most trivial setups an owner can overlook a server or a third-party sending agreement.

  1. List every sender: the mailbox provider, website forms, newsletter tool, invoicing, CRM, help desk and any device that relays mail. Also list domains that never send.
  2. Create a group or dedicated mailbox for reports, because a busy domain can receive hundreds of reports a day.
  3. Publish one SPF record that covers those senders within the 10-lookup budget.
  4. Turn on DKIM at each sender, with your domain as the signing domain and 2048-bit keys where your DNS host allows.
  5. Check a real message. Send mail from each system to a Gmail address, open More, then Show original, and read Authentication-Results for spf=pass, dkim=pass and a signing domain that matches your From domain.
  6. Wait 48 hours, then publish DMARC at p=none with rua. Google asks for that gap after setting up SPF and DKIM.
  7. Read the reports, fix every legitimate stream that fails alignment, then follow the rollout below.
  8. Protect domains that send nothing. The Canadian guidance recommends v=spf1 -all, p=reject and a null MX record.

Check the DNS side from any terminal, replacing the selector with your sender's:

dig +short TXT example.com                      # one record starting v=spf1
dig +short TXT s2026._domainkey.example.com     # the DKIM key at your selector
dig +short TXT _dmarc.example.com               # one record starting v=DMARC1

A website form is the sender people forget. Good Cleaner Co., a local cleaning company serving Ottawa homes and businesses whose site we build and run, sends its contact and job-application messages to the team's own inbox. They go out from the company's sender address, with the visitor's address in Reply-To. Neither form mails the address the visitor typed, so neither can act as a mail relay. If a form must mail an address someone types, such as a sign-up confirmation, put a bot check and a rate limit in front of it.

Warning

When DNS moves, mail records must move with it. Copy every TXT, CNAME and MX record before changing name servers and lower the TTLs first, as the DNS cutover section of our website migration guide describes. A missing record shows up as authentication failures, not an error.

How do you move from p=none to quarantine to reject?

The three policies are requests, not commands, and RFC 9989 says a receiver may choose whether to honour them. p=none asks receivers to take no action and send you reports. p=quarantine asks them to treat failing mail as suspicious, usually by sending it to spam. p=reject asks them to refuse it.

Three side-by-side stages: a failing envelope passes through while a report sheet is filed, then is diverted into a side tray, then is stopped by a plain orange bar and turned back.
Fig. 4 Each stage asks receivers to do more with mail that fails: nothing, set it aside, then refuse it.

The sources agree on that order and differ on the pace. As of December 2026:

SourceMonitor firstThenEnd state
Google Workspace (updated November 10, 2026)p=none for one weekQuarantine for a small percentage with pctReject if required
Microsoft 365p=none, length not givenQuarantine with pct steps of 10, 25, 50, 75, 100Reject is the goal
RFC 9989 (May 2026)A month or more, where users may post to listsQuarantine for as long againGeneral-purpose domains should not publish reject
Canadian Centre for Cyber Security (2021)Until reports are cleanQuarantine, then rejectReject at 100%

Our advice: decide by who sends. Run p=none for at least a month, so it covers a billing cycle, and longer if any system sends only quarterly, then p=quarantine for as long again. Stop there for a domain whose staff write to outside mailing lists, the case RFC 9989 warns about. Go on to p=reject for domains and subdomains that only machines send from, and for domains that send nothing. Yahoo advises separating mail by function, because each IP address and DKIM domain has its own reputation.

To trial a stricter policy, publish it with t=y, so receivers that implement the tag apply it one level lower. Fix legitimate failures before you enforce, because RFC 9989 says those shortcomings must be addressed first.

Public DNS shows the stages. As of December 2026, Minute Notary, an online notary platform we build and run, publishes p=quarantine for the domain and its subdomains and a 2048-bit DKIM key. Via Ottawa, a guide to local businesses across Ottawa that we build and run, publishes p=quarantine too. A third domain we manage is still at the monitoring stage: p=none with reports switched on.

Via Ottawa shows why the order matters, because for a time it ran the other way round. Its domain published quarantine before any system could send mail that aligned with it. With no DKIM key of its own, mail sent through a mailbox provider's SMTP failed DMARC and landed in spam, so the emails new users needed probably never arrived. A DNS check in September 2026 found the gap. In October sending moved to a delivery service. It signs with a key published under the domain and uses a dedicated subdomain with its own SPF record. The mail worker also refuses to start when the From address is missing and, on the mailbox-provider route, when it does not match the account that authenticates, because that provider rewrites a From it does not own without any error.

How do you read DMARC aggregate reports?

Receivers that send reports do so at least daily to your rua address, as an XML attachment, normally gzip-compressed (RFC 9990). The counts include messages that other filters went on to block. RFC 9989 recommends machine-parsing them, and Google recommends a third-party service when volume is high.

Three servers each send a report sheet to one orange mailbox tray. A box with a gear turns the reports into a grid of grey bars, a table.
Fig. 5 Receivers send daily reports to one address, and a tool turns them into a table you can act on.

Each record counts the messages from one sending IP. This made-up record repeats the vendor failure from earlier:

<row>
  <source_ip>203.0.113.25</source_ip>
  <count>42</count>
  <policy_evaluated><disposition>none</disposition><dkim>fail</dkim><spf>fail</spf></policy_evaluated>
</row>
<identifiers><header_from>example.com</header_from></identifiers>
<auth_results>
  <dkim><domain>vendor.example</domain><selector>s1</selector><result>pass</result></dkim>
  <spf><domain>bounce.vendor.example</domain><scope>mfrom</scope><result>pass</result></spf>
</auth_results>

The policy_evaluated element holds the alignment results and auth_results what the checks themselves said. Here both passed but neither aligned, the vendor pattern. A source you recognize that fails alignment needs a fix at the sender, and one you do not recognize is spoofing or a service nobody told you about.

What do Gmail, Yahoo and Outlook.com require from bulk senders?

Since 2024 the largest receivers have required authentication from high-volume senders. These are the rules as each provider's own page states them:

GmailYahooOutlook.com
Who and whenClose to 5,000 messages a day to personal accounts; from February 1, 2024, enforcement ramping up from November 2025Bulk senders, no volume given; from February 2024Over 5,000 a day; announced April 2, 2025, enforced from May 5, 2025
AuthenticationSPF and DKIM, DMARC at least p=none, From aligned with SPF or DKIMSPF and DKIM, DMARC at least p=none and passing; relaxed alignment acceptedSPF and DKIM pass, DMARC at least p=none aligned with one
UnsubscribeOne-click for marketing mail plus a visible link; honour within 48 hoursOne-click header (RFC 8058 POST recommended) plus a visible link; honour within 2 daysFunctional link listed as a practice; no one-click rule stated
If you miss itFailure codes or spam foldering for authentication and alignment; no mitigation support for a missing DMARC record or one-clickA negative effect on delivery, no code givenRejection with 550 5.7.515 per the April 2025 update

These rows come from Google's sender guidelines and its FAQ, Yahoo's best practices and Microsoft's announcement. Gmail's bulk status is permanent once reached. Microsoft's post still carries its earlier wording about the Junk folder first, beside the April update that says rejection, so check your bounce logs for the code. Under 5,000 a day you are not exempt: Google asks every sender for SPF or DKIM, valid forward and reverse DNS and TLS. Google and Yahoo also want spam rates under 0.3%, and Google advises under 0.10%.

RFC 8058 defines one-click unsubscribe with two headers, and a valid DKIM signature must cover both:

List-Unsubscribe: <https://mail.example.com/unsubscribe/7f3a9c>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

The address must be HTTPS, must not redirect, and must identify the recipient and list on its own, ideally with a hard-to-forge token, because the receiver unsubscribes the person with a POST that carries no cookies.

Minute Notary treats the abandoned-booking follow-ups it sends as commercial messages under Canada's anti-spam law, so each carries an unsubscribe link in the body and the two RFC 8058 headers. The opt-out list stores a hash of the address, not the address, so a purged enquiry can never bring a contact back. The link opens a page with one button, and only a POST records the opt-out, because link scanners and mail-client prefetchers often open the links in an email and none of them may unsubscribe a customer.

Complaints matter as much as headers. Send only to people who asked for the mail, and suppress addresses that bounce or complain. Where your delivery service reports those events to your site by webhook, treat that endpoint like any other webhook receiver.

What breaks when mail is forwarded or sent through a mailing list?

Forwarding and mailing lists send your mail through a server that is not yours, and each breaks a different check (RFC 7960).

Forwarding usually breaks SPF. If the forwarder keeps your envelope sender, SPF fails unless the forwarder is authorized in your record. If it replaces the envelope sender with its own, SPF can pass but no longer aligns. Either way DKIM has to carry the DMARC pass, and a signature can survive a plain relay.

Mailing lists break DKIM. Lists commonly add a subject tag or footer, remove MIME parts or convert to plain text, and any of those invalidates the signature. When a list reposts mail from a p=reject domain without rewriting the From line, RFC 9989 says it is frequently rejected, and list software can read the refusals as dead addresses and unsubscribe the subscribers. List software has since adopted workarounds that rewrite the From address.

An envelope with a seal leaves a sender, passes a relay outside the sender's dashed outline where a footer strip is added, and arrives with its orange seal cracked.
Fig. 6 A forwarder is not in the sender's SPF record, and a footer added on the way breaks the DKIM signature.

Three rules follow. Sign every message with DKIM, because RFC 9989 says a domain that publishes reject must not rely on SPF alone. Keep the domains your people write from at quarantine if they post to outside lists. And read your reports: receivers can note in a reason field that they delivered failing mail because it came through a mailing list or a trusted forwarder.

What is ARC, and does it fix this?

The Authenticated Received Chain, RFC 8617, lets each intermediary seal the authentication results it saw, so the final receiver can tell what passed before the message was changed. It is an Experimental RFC from July 2019, and RFC 9989 says that after about a decade of attempts none of the methods for letting lists keep the From line have become widely used. Gmail reads ARC results on forwarded mail, and Microsoft 365 lets administrators name trusted ARC sealers.

How do you troubleshoot SPF, DKIM and DMARC failures?

Start with the evidence: the Authentication-Results header from step 5, or the headers pasted into the message header tool in Google's Admin Toolbox. Then match the symptom:

What you seeLikely causeWhat to do
spf=permerror or "too many DNS lookups"More than 10 lookups, two SPF records, or a syntax errorCount lookups, drop unused includes, merge to one record
spf=softfail or fail for mail you sentThe sender's IP is not in your recordAdd the service's include, then wait 24 to 48 hours
spf=pass and dkim=pass but dmarc=failBoth passes belong to the vendor's domainSign with your domain, or use a bounce subdomain of yours
dkim=fail, "body hash did not verify"The message changed after signing, such as a gateway footerSign after the last edit, or stop the gateway editing
No DKIM result, or the DNS host refuses the keyDKIM is off, the selector is wrong, or a 2048-bit key exceeds one stringCheck the record at the selector; split a long key into two quoted strings
Bounce 5.7.26, "not accepted due to domain's DMARC policy"Mail failed DMARC under quarantine or rejectFix SPF or DKIM alignment; strict alignment makes failure likelier
Everything passes and mail still lands in spamAuthentication is not reputation or contentCheck spam rate, list quality, content and complaint handling

The rows draw on Google's troubleshooting pages for SPF and DMARC. Change one record at a time and note its TTL first, because a change you want to undo can stay cached for that long. If you are enforcing and legitimate mail is failing, step back one level while you fix it.

What are BIMI, MTA-STS and TLS-RPT, and do you need them?

None of these is a reason to delay the core three.

BIMI shows a brand logo beside authenticated mail. It is still an IETF draft, revision 15 of October 31, 2026, and it requires a quarantine or reject policy on both the organizational domain and the From domain, so it rewards finishing the rollout.

MTA-STS (RFC 8461, 2018) protects mail sent to your domain. An attacker who deletes the 250 STARTTLS response can strip SMTP's opportunistic encryption, and MTA-STS lets you publish that senders should require valid TLS. It uses a TXT record at _mta-sts and a policy file at https://mta-sts.example.com/.well-known/mta-sts.txt, with a mode of testing, enforce or none. The policy host needs a valid certificate, so our SSL certificate renewal guide applies. TLS-RPT (RFC 8460) is the reporting side: a TXT record at _smtp._tls tells senders where to send TLS failure reports.

What should you do this week?

  1. List every system that sends as your domain, and every domain that sends nothing.
  2. Merge SPF into one record ending in ~all, and make each sender sign with your own domain.
  3. Publish DMARC at p=none with reports going to a dedicated mailbox or a processing service.
  4. Read the reports for a month, fix what fails alignment, then move to quarantine and decide on reject by who sends.

Our IT support service administers Microsoft 365 and Google Workspace tenants, including mail flow with DMARC, SPF and DKIM, and our hosting and maintenance service inventories sites, domains and mail and runs DNS cutovers with lowered TTLs.