DNS and security provider with Email Routing for custom domains. This guide covers the complete email authentication stack for Cloudflare: SPF, DKIM, and DMARC. Each section gives you the exact DNS records, step-by-step instructions, common pitfalls, and how to verify your setup.
Configure SPF for domains using Cloudflare Email Routing to ensure forwarded and routed email passes authentication.
TXT
@
v=spf1 include:_spf.mx.cloudflare.net ~all
This SPF include is for Cloudflare Email Routing. Cloudflare itself is not an email sender -- it routes email to your actual mailbox provider.
Go to dash.cloudflare.com and sign in.
Choose the domain where you want to set up Email Routing.
Go to Email > Email Routing. Follow the setup wizard to configure routing rules.
Cloudflare may auto-add DNS records during Email Routing setup. If not, add the SPF include manually.
v=spf1 include:_spf.mx.cloudflare.net ~allSend a test email to your routed address and confirm delivery and SPF pass.
v=spf1 include:_spf.google.com ~allv=spf1 include:_spf.google.com include:_spf.mx.cloudflare.net ~allOnly if you use Cloudflare Email Routing. If Cloudflare is just your DNS provider, add SPF records for your actual email service instead.
Cloudflare Email Routing lets you create email addresses on your domain and forward them to existing mailboxes (like Gmail). It does not host mailboxes.
Yes. Combine both: v=spf1 include:_spf.google.com include:_spf.mx.cloudflare.net ~all.
Understand DKIM configuration when using Cloudflare Email Routing or Cloudflare as your DNS provider.
CNAME
Depends on your email provider
Depends on your email provider
Cloudflare Email Routing does not require its own DKIM record. Add DKIM records for your actual email sending provider. Cloudflare DNS is where you manage all DKIM records.
Cloudflare is typically your DNS provider, not your email sender. DKIM records for your email provider (Google Workspace, Microsoft 365, etc.) are added through Cloudflare's DNS dashboard.
Go to dash.cloudflare.com and select your domain.
Go to DNS > Records.
Add the DKIM TXT or CNAME records provided by your email service. Cloudflare DNS supports both record types.
# Example for Google Workspace:
google._domainkey TXT "v=DKIM1; k=rsa; p=YOUR_KEY"
# Example for Microsoft 365:
selector1._domainkey CNAME selector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.comAfter adding DKIM records in Cloudflare DNS, verify them in your email provider's dashboard.
No. Cloudflare Email Routing forwards email and does not add its own DKIM signature. DKIM signing is handled by your email sending provider.
Go to DNS > Records in your Cloudflare dashboard. Add the TXT or CNAME records provided by your email service. Ensure the proxy is set to DNS-only (gray cloud).
Email DNS records (MX, TXT for SPF/DKIM, CNAME for DKIM) must resolve directly, not through Cloudflare's HTTP proxy. The orange cloud proxy is only for web traffic.
Add a DMARC record to your domain through Cloudflare DNS to protect against email spoofing.
TXT
_dmarc
v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1
Cloudflare provides a DMARC management tool in the dashboard under Email > DMARC Management.
Go to dash.cloudflare.com and select your domain.
Cloudflare offers a DMARC Management feature under Email > DMARC Management. This provides a guided setup and report visualization.
Use Cloudflare DMARC Management or manually add a TXT record via DNS > Records.
_dmarc.yourdomain.com TXT "v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1"Cloudflare DMARC Management can parse and display your DMARC reports, showing which senders pass or fail.
Use the insights from Cloudflare DMARC Management to identify all legitimate senders, then move to p=quarantine and p=reject.
Yes. Cloudflare offers a free DMARC Management tool under Email > DMARC Management that helps set up and monitor DMARC.
Yes. Cloudflare DMARC Management collects and visualizes aggregate DMARC reports, showing you which senders pass or fail authentication.
Yes. Cloudflare DMARC Management is available on all plans including the free tier.
Once your SPF, DKIM, and DMARC records are in place, run a full domain scan to confirm everything is configured correctly. DNS changes typically propagate within minutes but can take up to 48 hours.