In short. Cloudflare hosts your DNS, not your mailboxes, so the values for SPF and DKIM come from your mail provider and you publish them on Cloudflare's DNS Records page. DMARC can be a TXT record or handled with DMARC Management. Tighten the policy only after reading the reports.
SPF lists the servers allowed to send for your domain, DKIM signs each message, and DMARC tells receivers what to do with mail that fails both. These records only count if your domain uses Cloudflare's name servers.
Last verified: November 26, 2026, against Cloudflare's official developer documentation (checked November 13, 2026).
Before you start
Log in to the Cloudflare dashboard, select your account and domain, and open the DNS Records page. You can also go to Email > DMARC Management and select View records under Email record overview to see your SPF, DKIM and DMARC records in one place.
1. SPF
Select Add record, type TXT, name @, and as content your SPF rule from your mail provider, TTL Auto, then Save. For example, Google Workspace plus a newsletter tool:
v=spf1 include:_spf.google.com include:servers.example-newsletter.com ~allReplace the second include: with your real provider's value. If you use Cloudflare Email Routing, it adds v=spf1 include:_spf.mx.cloudflare.net ~all: Cloudflare says to merge it with any existing SPF record rather than add a second one.
2. DKIM
Turn DKIM on in your mail provider's admin console (Google Workspace, Microsoft 365, your host's email) and publish the key it gives you as a TXT or CNAME record on the DNS Records page, with the exact name and value shown by the provider.
3. DMARC
Option A: add a TXT record named _dmarc with v=DMARC1; p=none; rua=mailto:[email protected]. Option B: go to Email > DMARC Management > Enable DMARC Management, and select Add if you have no DMARC record. With an existing record, Cloudflare adds a second rua address of its own; the feature works only on the apex domain, and the first report can take up to 24 hours to appear. Choose one option: a hand-made record plus another from DMARC Management would make receivers ignore both.
Then tighten DMARC step by step
Start with p=none and read the reports for one to two weeks. Once every legitimate sender passes, move to p=quarantine, then to p=reject after several clean weeks. Never publish quarantine or reject straight away: one forgotten sender, such as an invoicing tool, would have its mail sent to spam or refused. Google recommends the same staged rollout.
Common mistakes
- Two SPF records on the same domain: SPF fails with an error. Merge them into one.
- Two DMARC records on
_dmarc: receivers ignore both. - More than 10 DNS lookups in SPF (each
include:costs at least one; RFC 7208): SPF fails. - Typing the full name in the host field:
_dmarc.yourdomain.comcan become_dmarc.yourdomain.com.yourdomain.com. Enter only_dmarc, and check the result in the list. - Forgetting
mailto:in theruaaddress. - Forgetting other senders (newsletter, invoicing, online shop): each must pass SPF or sign with DKIM for your domain.
Check that it works
Wait for the change to be visible (minutes to hours, sometimes up to 48 hours), then:
nslookup -type=TXT yourdomain.com
nslookup -type=TXT _dmarc.yourdomain.comYou should see one line starting with v=spf1 and one line starting with v=DMARC1. Our free tools read both and the DKIM key: use the SPF, DKIM and DMARC checkers linked above. For a full test, send an email to a Gmail address, open it, choose Show original: SPF, DKIM and DMARC should read PASS.
Free tool. SPF checker · DKIM checker · DMARC checker
Check your domain for free. AttackScout reads your public SPF, DKIM and DMARC records and tells you what to change. Run the free check
Frequently asked questions
Do I need all three at Cloudflare?
Gmail and Microsoft require SPF, DKIM and DMARC from senders of more than 5,000 messages a day, and a complete setup helps at every volume. DMARC only passes when SPF or DKIM passes with your own domain, so set SPF and DKIM first.
How long before it works?
Providers announce from a few minutes to 48 hours for DNS changes to be visible everywhere. Test after a short wait.
Should I start with p=reject?
No. Start with p=none, read the reports, then tighten.
Related pages
Sources
Accessed on 11/26/2026.
- Cloudflare, Create DNS records: https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/
- Cloudflare, Enable DMARC Management: https://developers.cloudflare.com/dmarc-management/enable/
- Cloudflare, Security records: https://developers.cloudflare.com/dmarc-management/security-records/
- Cloudflare, Email Routing DNS records: https://developers.cloudflare.com/email-routing/setup/email-routing-dns-records/
- IETF, RFC 7208 (SPF): https://www.rfc-editor.org/rfc/rfc7208
- IETF, RFC 9989 (DMARC, May 2026): https://www.rfc-editor.org/info/rfc9989
- Google Workspace, Recommended DMARC rollout: https://knowledge.workspace.google.com/admin/security/recommended-dmarc-rollout