How to set up SPF, DKIM and DMARC for transactional email

Updated:

Set up SPF, DKIM and DMARC in that order. Add the SPF include or return-path record your email service gives you, then publish its DKIM key so every message carries a signature. Last, publish a DMARC record at _dmarc.yourdomain.com with p=none and a report address, and tighten it to quarantine and reject once reports show your mail passing. Gmail and Yahoo have required SPF or DKIM from every sender since February 2024, and all three records from bulk senders.

What SPF, DKIM and DMARC do

SPF lists the servers allowed to send for a domain. DKIM signs each message with a key published in DNS. DMARC ties both to the From address the reader sees: it passes only when SPF or DKIM passes for a domain that aligns with the From domain, and it tells receivers what to do with mail that fails.

Record Where it lives What it checks Standard
SPF TXT on the envelope sender (return-path) domain The sending server is on the domain’s list RFC 7208 (opens in a new tab)
DKIM TXT or CNAME at selector._domainkey.yourdomain.com The signature matches the public key RFC 6376 (opens in a new tab)
DMARC TXT at _dmarc.yourdomain.com SPF or DKIM passes and aligns with the From domain RFC 9989 (opens in a new tab), which replaced RFC 7489 in May 2026

What is SPF?

SPF (Sender Policy Framework) is a TXT record that starts with v=spf1 and lists who may send mail for your domain, usually through include: entries that point to your email services. A domain may publish only one SPF record, and RFC 7208 limits each check to 10 DNS lookups. A second record or an eleventh lookup returns a permanent error, and SPF does not pass.

An SPF record for a domain that sends through Mailgun and Brevo:

example.com.  TXT  "v=spf1 include:mailgun.org include:spf.brevo.com ~all"

~all is a softfail, which RFC 7208 says receivers should not reject on alone. -all is a hard fail.

The 10-lookup limit. RFC 7208 counts the include, a, mx, ptr and exists mechanisms and the redirect modifier, including those inside each include. To stay under 10, remove services you no longer use and prefer services that keep SPF on their own subdomain. Postmark, SMTP2GO, SocketLabs and Bird Email pass SPF through a return-path CNAME, Amazon SES uses a custom MAIL FROM subdomain, and Resend and Loops put SPF on a send or envelope subdomain. None of these add lookups to your main SPF record.

What is DKIM?

DKIM (DomainKeys Identified Mail) adds a signature to every message. Your email service signs with a private key, and receivers fetch the public key from DNS at selector._domainkey.yourdomain.com. Some services give you a TXT record that holds the key, such as Resend at resend._domainkey. Others give you CNAME records that point to keys they host, such as SendGrid’s s1 and s2 records.

CNAME records let the service change keys without asking you to edit DNS. Mailchimp Transactional, for example, asks for mte1._domainkey pointing to dkim1.mandrillapp.com and a second record for mte2, and Mailgun’s Automatic Sender Security rotates keys every 120 days by default.

DKIM on your own domain is usually what makes DMARC pass. Amazon SES, for example, documents that with its default MAIL FROM domain, DMARC passes through DKIM alignment.

What is a DMARC record?

A DMARC record is a TXT record at _dmarc.yourdomain.com that tells receivers what to do with mail that fails authentication and where to send reports. It starts with v=DMARC1, sets a policy with p= and usually names a report address with rua=. The tags of a first record:

Tag Example value What it does
v DMARC1 Version. It must be the first tag
p none Policy for failing mail: none, quarantine or reject
rua mailto:dmarc@example.com Where receivers send aggregate reports. Without it, they send none
sp quarantine Optional policy for subdomains
t y Optional test mode that applies the policy one level lower

Write the tags as one TXT value in the form tag=value, with a semicolon between tags. A first record for example.com looks like this:

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

By default alignment is relaxed, so a return path on bounces.example.com aligns with a From address on example.com. RFC 9989 dropped the old pct tag and added t.

In what order should you set them up?

Set up SPF and DKIM first, confirm both pass, then publish DMARC at p=none. DMARC only passes when SPF or DKIM passes and aligns, so a strict policy published before DKIM works would block your own mail. RFC 9989 starts at p=none to catch anything missed in the SPF and DKIM setup.

  1. List every service that sends as your domain. Microsoft notes that authentication is tied to your domain even when a vendor sends for you.
  2. Add SPF. Merge each include into one record, or add the service’s return-path CNAME.
  3. Add DKIM. Publish each service’s records and click verify in its dashboard.
  4. Test. Check that a test message shows SPF and DKIM passing in its headers.
  5. Publish DMARC at p=none with a rua address, and read the reports.
  6. Fix failing sources, then move to quarantine and later reject.

DMARC policy: from p=none to quarantine to reject

Move DMARC in three steps. p=none asks for reports and changes nothing about delivery. p=quarantine says you consider failing mail suspicious, which often means the spam folder. p=reject says failing mail is not valid, so receivers can refuse it. RFC 9989 suggests at least a month at p=none, then an equally long period at p=quarantine.

Step Policy Move on when
1 p=none Reports show every legitimate source passing, after at least a month
2 p=quarantine Another month passes with no legitimate mail failing
3 p=reject This is the end state

To trial a stricter policy, add t=y, and receivers apply reject as quarantine and quarantine as none. Step 1 already meets the Gmail and Yahoo bulk sender rules.

Gmail, Yahoo and Outlook sender requirements

Gmail and Yahoo require SPF or DKIM from every sender, and SPF, DKIM and DMARC at p=none or stricter from bulk senders. Gmail treats anyone sending more than 5,000 messages a day to Gmail accounts as a bulk sender. Outlook.com requires all three from domains sending over 5,000 emails a day, and Microsoft’s updated announcement says failing mail is rejected from May 5, 2025.

Requirement Gmail (opens in a new tab) Yahoo (opens in a new tab) Outlook.com (opens in a new tab)
SPF and DKIM SPF or DKIM for all, both above 5,000 a day SPF or DKIM for all, both for bulk Both must pass above 5,000 a day
DMARC p=none or stricter above 5,000 a day, aligned p=none or stricter for bulk, relaxed alignment accepted p=none or stricter, aligned
Spam rate Below 0.3%, aim for below 0.1% Below 0.3% Not stated

Google’s sender FAQ adds that bulk sender status does not expire and that from November 2025 Gmail is ramping up enforcement with temporary and permanent rejections. Both also require one-click unsubscribe in bulk marketing mail, which our guide to what transactional email is covers.

SPF and DKIM records by email service

Most services hand out DKIM as CNAME records and handle SPF either with an include for your main SPF record or with a return-path CNAME on a subdomain. The table lists what each service’s documentation asks for. Copy the exact values from your account, since many are unique to it.

Service SPF DKIM
Amazon SES include:amazonses.com on a custom MAIL FROM subdomain 3 CNAME records to dkim.amazonses.com, or your own key
Bird Email (SparkPost) Through the return-path CNAME send.<your domain> TXT at a selector unique to your account
Brevo include:spf.brevo.com 1 TXT or 2 CNAME records
Cloudflare Email Service include:_spf.mx.cloudflare.net on the cf-bounce subdomain TXT at cf-bounce._domainkey
Elastic Email include:_spf.elasticemail.com TXT at api._domainkey
Loops TXT on envelope.<your domain>, value in the app Records from the app
Mailchimp Transactional No include requested 2 CNAME records, mte1 and mte2
MailerSend Value in the account, merged with your record 2 CNAME records, ms1 and ms2
Mailgun include:mailgun.org TXT at a selector you choose, or 2 CNAME records
Mailjet include:spf.mailjet.com TXT at mailjet._domainkey
Mailtrap Covered by the verification record per its DNS guides, include:_spf.mailtrap.io in its API quickstart 2 CNAME records, rwmt1 and rwmt2
Postmark Through the pm_bounces return-path CNAME TXT with the host and value from the account
Resend include:amazonses.com on the send subdomain TXT at resend._domainkey
SendGrid Through the em#### CNAME, or include:sendgrid.net with manual security 2 CNAME records, s1 and s2, or TXT at m1._domainkey
SendPulse include:mxsspf.sendpulse.com TXT at sign._domainkey
SMTP2GO Through the return-path CNAME CNAME to dkim.smtp2go.net
SocketLabs Through the custom bounce domain CNAME CNAME to dkim._domainkey.email-od.com
Zoho CPaaS (ZeptoMail) include:cpaas.net, though its domains page says only DKIM and a bounce CNAME are needed TXT at a selector you choose or Zoho generates

Next, read the transactional email deliverability guide, or compare these services in the best transactional email services ranking and the SendGrid review, Mailgun review and Amazon SES review.

Frequently asked questions

What is SPF in email?

SPF (Sender Policy Framework) is a DNS TXT record that lists the servers allowed to send mail for a domain. Receivers check the envelope sender’s domain against it, and RFC 7208 caps the check at 10 DNS lookups.

What is the correct order to set up SPF, DKIM and DMARC?

SPF and DKIM first, then DMARC with a policy of p=none. Once DMARC reports show all your legitimate mail passing, move the policy to quarantine and then to reject.

What should my first DMARC record be?

A TXT record at _dmarc.yourdomain.com with v=DMARC1, a policy of p=none and a rua address for reports. It meets the Gmail and Yahoo minimum and does not change delivery while you check your senders.

Do Gmail and Yahoo require DMARC?

Yes, for bulk senders. Gmail requires SPF, DKIM and a DMARC policy of at least p=none from anyone sending more than 5,000 messages a day to Gmail accounts, and Yahoo sets the same minimum for its bulk senders.

Do I need an SPF include for my email service?

Not always. Mailgun, Brevo, Mailjet and SendPulse give you an SPF include, while Postmark, SMTP2GO, SocketLabs and Bird Email pass SPF through a return-path CNAME and need no change to your main SPF record.

Sources

Prices and features come from each vendor's own pages, and other facts from the pages listed here, read on the dates shown. Prices exclude sales tax.