Samprix

Guide

Add SPF, DKIM, DMARC and MX records in Cloudflare

Where to add SPF, DKIM, DMARC and MX records in the Cloudflare dashboard, and the proxy setting that breaks DKIM.

Updated

Email authentication comes down to a handful of DNS records: SPF, DKIM and DMARC, plus MX to receive mail. Your email provider tells you what they should say; this guide shows where to put them in Cloudflare. You can tell your DNS is at Cloudflare when your domain’s name servers look like ns.cloudflare.com; the WHOIS lookup shows them.

Open the record editor

  1. Sign in to the Cloudflare dashboard (dash.cloudflare.com) and select your domain.
  2. Open DNS → Records and click Add record.
  3. Choose the record type, fill in Name and Content, and save. Leave TTL at its default.

What to enter for each record

RecordTypeNameContent
SPFTXT@v=spf1 include:… ~all
DKIMTXT or CNAME, as your provider saysselector._domainkey (e.g. google._domainkey)The key or target your provider gives you
DMARCTXT_dmarcv=DMARC1; p=none; rua=mailto:…
MXMX@Your provider’s mail server, with its priority

Cloudflare uses @ for the domain itself. For any other name, type only the part before your domain: _dmarc, not _dmarc.example.com.

Cloudflare specifics

  • Set every CNAME used for DKIM to “DNS only” (the grey cloud). A proxied (orange) CNAME doesn’t point at your provider’s key, so DKIM fails.
  • If Cloudflare Email Routing is on, it manages your MX records and adds its own SPF include. Merge your provider’s include into that one record instead of adding a second.
  • Cloudflare shows names in full (with your domain added). Type only the part before your domain, such as _dmarc.

Mistakes that break email authentication

  • The domain written twice. Typing the full name where the panel adds your domain creates _dmarc.example.com.example.com, which nothing looks up. Check the record with our DNS lookup.
  • A second SPF record. A domain may have only one TXT record starting v=spf1; with two, SPF fails for all your mail. Edit the existing one and add the new include to it.
  • Old MX records left in place. When you switch email provider, delete the previous provider’s MX records, or some mail keeps going there.
  • Checking too soon. A new record usually shows up within minutes, but a changed one can take as long as its old TTL. The DNS propagation checker shows who has the new value yet.

Records for your email provider

The exact records, and where to turn on DKIM, for common providers:

Using another provider? The SPF and DMARC generators build the records, and the health check shows what’s still missing.

All tools