CCyberwiki

Setting up SPF, DKIM and DMARC

A receiving server tells a domain's genuine mail from a forgery by looking up three kinds of record in the domain's DNS: an SPF record naming the services that send for it, a DKIM key for each service that signs, and a DMARC record that ties both checks to the From: address and tells receivers what to do with mail that fails. How each check works is in Email authentication (SPF, DKIM and DMARC); the attack the records stop is Email spoofing. Gmail requires SPF or DKIM from everyone who sends to personal Gmail accounts, and all three from senders of more than 5,000 messages a day.1

Values and screen names below are as the providers' pages showed them on 22 November 2026. The record types (TXT, CNAME, MX) are described in DNS records.

Table 1. Records per sending service
ServiceSPF includeDKIM record
Google Workspaceinclude:_spf.google.comTXT at google._domainkey, key from the Admin console
Microsoft 365include:spf.protection.outlook.comTwo CNAME records, selector1._domainkey and selector2._domainkey
Amazon SESinclude:amazonses.com, on the MAIL FROM subdomainThe records the SES console lists for Easy DKIM

Steps

1. List every sender

Write down each system that sends mail with the domain in it: the mailbox provider, the service that sends password-reset mail, a help desk, a web server that sends on its own.1 A sender missing from the list fails SPF, and once DMARC is enforced its mail goes to spam or is refused unless its DKIM signature matches the domain. Bulk mail from outside services belongs on a subdomain such as marketing.example.com, to keep its reputation apart from the main domain.23

2. Publish one SPF record

Add a single TXT record at the domain itself (host @). It starts with v=spf1, names each sender with include: and ends with an all rule.1 A domain that sends through Google Workspace and Zendesk publishes:

example.com.  TXT  "v=spf1 include:_spf.google.com include:mail.zendesk.com ~all"

Amazon SES goes on its own subdomain instead (step 4). All other senders go into the one record, which can hold up to 10 include: terms. A second SPF record, or one over the DNS lookup limit, breaks the check for all mail; Email authentication (SPF, DKIM and DMARC) gives the rules. A subdomain that sends mail needs a record of its own, because SPF does not apply to subdomains.1

Providers disagree on the ending. Google recommends ~all (softfail).1 Microsoft recommends -all (fail), because it finds that a ~all failure on a message with no DKIM signature leaves the DMARC policy without effect.4

3. Turn on DKIM signing

The sending service keeps the private key and gives you the public key to publish.5 A signature counts for DMARC only when its signing domain matches the From: domain, so a service that signs with its own domain does not help until your domain is set up.6

Google Workspace. In the Admin console, open Menu > Apps > Google Workspace > Gmail > Authenticate email, choose the domain under Selected domain and click Generate New Record. Pick a 2048-bit key where the DNS host accepts one, keep the selector (the first part of the record name) as google and click Generate. Publish the TXT value it shows at google._domainkey, allow up to 48 hours, then click Start authentication. The status becomes Authenticating email with DKIM.5

Microsoft 365. Microsoft 365 does not sign custom-domain mail until this is done. In the Defender portal, go to Email & collaboration > Policies & rules > Threat policies > Email authentication settings and open the DKIM tab. Slide the domain's Toggle to Enabled; the error dialog that opens is expected. Open the domain's row and publish the two values under Publish CNAMEs as CNAME records at selector1._domainkey and selector2._domainkey. Once Microsoft 365 detects the records, turn on Sign messages for this domain with DKIM signatures in the same flyout.7

Amazon SES. Easy DKIM signs with a 2048-bit key unless 1024 bits is chosen; publish the records the console lists.8

4. Move the bounce address onto the domain

Sending services put their own domain in the envelope sender (the hidden MAIL FROM address) so that bounces return to them. SES uses a subdomain of amazonses.com by default, so SPF passes for that name and never matches the From: domain.96 A custom MAIL FROM subdomain, used for nothing else, gives SPF a matching domain. For SES in the Region us-east-1:

mail.example.com.  MX   10 feedback-smtp.us-east-1.amazonses.com
mail.example.com.  TXT  "v=spf1 include:amazonses.com ~all"

If the MX record is wrong, Behavior on MX failure either falls back to the default MAIL FROM domain or rejects the send.9 The DMARC record must then keep relaxed SPF alignment, which rules out aspf=s. The step is optional where DKIM already matches, since DMARC needs only one of the two to align.6

5. Publish DMARC in monitoring mode

Add a TXT record at _dmarc, with v and p as the first two tags and a mailto: address in rua for aggregate reports:10

_dmarc.example.com.  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@example.com"

With p=none receivers deliver failing mail as before and send reports, often several a day, on the mail that used the domain.10 An rua address at another domain needs that domain to publish example.com._report._dmarc TXT v=DMARC1; to accept the reports.11

6. Raise the policy

When the reports show every genuine sender passing with a matching domain, change p=none to p=quarantine, which sends failing mail to spam, and later to p=reject, which refuses it.10 At p=reject the domain must not rely on SPF alone: forwarding breaks SPF, while DKIM signatures generally survive it, so each sender needs a matching DKIM signature.11

Google and Microsoft still describe pct, the share of failing mail the policy applies to, as the way to roll out in stages.102 RFC 9989 dropped pct in May 2026, because receivers applied it reliably only at 0 and 100, and added t=y, a testing flag that asks receivers to hold back the policy. Its example moves from p=quarantine with t=y to p=reject without it.11

7. Close domains that send no mail

A registered domain that sends nothing can still appear in a forged From: line. Give it an SPF record that allows no server and a DMARC record that asks for rejection, and publish no DKIM key, so that no signature can verify:427

example.net.         TXT  "v=spf1 -all"
_dmarc.example.net.  TXT  "v=DMARC1; p=reject"

The DMARC record also covers every subdomain without its own record, including names that do not exist; SPF covers them only through a wildcard record, where the DNS host supports one.42

In SecFlash

The Email and domain page reports each record these steps add when it is missing or weak: no SPF record (SF-EML-101), an SPF record ending in +all (SF-EML-104), with no ending (SF-EML-105) or ending in ?all (SF-EML-106), two SPF records (SF-EML-107) and more than 10 lookups (SF-EML-108). It reports no DKIM key found as SF-EML-109, no DMARC record as SF-EML-102, a policy left at p=none as SF-EML-103 and a DMARC record with no rua address as SF-EML-110.

See also

References

  1. a b c d e Google (updated 10 November 2026). "Set up SPF". Google Workspace Admin Help.
  2. a b c d Microsoft (n.d., read 22 November 2026). "Set up DMARC to validate the From address domain for cloud senders". Microsoft Learn.
  3. back Resend (n.d., read 22 November 2026). "Verified domains". Resend Docs.
  4. a b c Microsoft (updated 3 July 2026). "Set up SPF to identify valid email sources for your Microsoft 365 domain". Microsoft Learn.
  5. a b Google (updated 10 November 2026). "Set up DKIM". Google Workspace Admin Help.
  6. a b c Amazon Web Services (n.d., read 22 November 2026). "Complying with DMARC authentication protocol in Amazon SES". Amazon SES Developer Guide.
  7. a b Microsoft (n.d., read 22 November 2026). "Set up DKIM to sign mail from your Microsoft 365 domain". Microsoft Learn.
  8. back Amazon Web Services (n.d., read 22 November 2026). "Easy DKIM in Amazon SES". Amazon SES Developer Guide.
  9. a b Amazon Web Services (n.d., read 22 November 2026). "Using a custom MAIL FROM domain". Amazon SES Developer Guide.
  10. a b c d Google (updated 10 November 2026). "Set up DMARC". Google Workspace Admin Help.
  11. a b c Herr, T. and Levine, J., eds. (May 2026). "RFC 9989: Domain-based Message Authentication, Reporting, and Conformance (DMARC)". RFC Editor. IETF.