Cloudflare DNS Setup for SPF, DKIM, DMARC & Email Routing

How to add SPF, DKIM, DMARC, and MX records in Cloudflare DNS cleanly — avoiding CNAME flattening traps and orange-cloud proxy errors.

Proxy: DNS Only (Grey)SPF: _spf.mx.cloudflare.netAuto TXT Splitting

Copy-Ready DNS Records & Configuration

Host / NameTypeValueTTLPurpose
@ TXT v=spf1 include:_spf.mx.cloudflare.net include:amazonses.com ~all Auto Use root apex @; Cloudflare handles >255B TXT chunking automatically
s1._domainkey CNAME s1.domainkey.u12345.wl.sendgrid.net Auto MUST be DNS Only (Grey Cloud) — Proxied CNAME breaks DKIM lookups
_dmarc TXT v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com; Auto Cloudflare DMARC Management can also host a free aggregate report inbox

Interactive SPF, DKIM, DMARC & CAA Record Builder

Select Email Providers (Lookup Weight Shown)

1. SPF TXT Record (Host: @)


      
2. DMARC TXT Record (Host: _dmarc)


      
3. DKIM TXT Record Template


      
4. Complete BIND Zone Snippet (SPF + DMARC + CAA)

    

Step-by-Step Deployment Checklist

  1. Always toggle **Proxy status = DNS Only (grey cloud)** for every CNAME pointing to a DKIM selector (`*._domainkey`), Return-Path (`em.*`, `pm-bounces`), or mail host (`mail.yourdomain.com`).
  2. When enabling Cloudflare Email Routing for inbound forwarding, verify Cloudflare added `include:_spf.mx.cloudflare.net` without duplicating your existing `v=spf1` record.
  3. Enable **Cloudflare DMARC Management** (free on all plans) to visualize aggregate XML reports without paying for a third-party DMARC SaaS.
  4. Turn on **DNSSEC** in Cloudflare DNS -> Settings with one click, then copy the DS record to your registrar.

Common Pitfalls to Avoid

Chrome Extension — DiffRadar + Gumroad

Track DNS Console Changes, Status Pages & Vendor Docs Automatically

Use our DiffRadar Chrome Extension to watch cloud provider policy updates and grab our Indie Infra & Automation Kits on Gumroad.

Frequently Asked Questions

Why must DKIM CNAME records be DNS Only (grey cloud) in Cloudflare?

Cloudflare's orange-cloud proxy only handles HTTP/HTTPS traffic and rewrites CNAME records into Cloudflare edge A/AAAA records, which destroys DKIM TXT resolution.

Does Cloudflare Email Routing let me send outbound emails?

No. Cloudflare Email Routing is inbound forwarding only; pair it with Resend, Amazon SES, Postmark, or Google Workspace for outbound SMTP/API mail.

Does Cloudflare support 2048-bit DKIM TXT records?

Yes. Paste the full unquoted `v=DKIM1; k=rsa; p=...` value into Cloudflare DNS and Cloudflare automatically splits it into RFC-compliant 255-byte chunks.

Related DNS & Email Auth Guides