How to set up SPF, DKIM and DMARC on Cloudflare
4 December 2026 · 6 min read
Cloudflare's DNS is fast, free and popular with developers. This guide shows where SPF, DKIM and DMARC records go in the Cloudflare dashboard, the settings that matter for email, and the mistakes that stop records from verifying. It uses the records an email service gives you for a sending subdomain such as notify.example.com.
Before you start: is your DNS at Cloudflare?
If your domain shows as Active in your Cloudflare dashboard, its nameservers point to Cloudflare and this is where records go, even if you bought the domain at GoDaddy or Hostinger. Records you add at the registrar are then ignored.
The records you'll add
Your email service shows the exact values; the DKIM key is unique to your domain.
| Purpose | Type | Name | Content |
|---|---|---|---|
| DKIM | TXT | trivsend._domainkey.notify | v=DKIM1; k=rsa; p=MIIBIjAN... |
| Return path | MX | bounces.notify | mail.trivsend.com, priority 10 |
| SPF | TXT | bounces.notify | v=spf1 include:_spf.trivsend.com ~all |
| DMARC | TXT | _dmarc.notify | v=DMARC1; p=none; rua=mailto:... |
Cloudflare accepts the Name either as the short form above or as the full name (bounces.notify.example.com); it works out which you meant. The short form is the safest habit, because it works in almost every DNS panel.
Step by step
- Sign in to Cloudflare and click your domain.
- Open DNS, then Records, and click Add record.
- Fill in the fields as below and click Save.
- Repeat for each row in the table above.
| Field | What to enter |
|---|---|
| Type | TXT or MX |
| Name | The name from the table |
| Content (TXT) or Mail server (MX) | Paste it exactly |
| Priority | 10 (MX only) |
| TTL | Auto |
Settings that matter for email
- Proxy status. The orange cloud only applies to A, AAAA and CNAME records, so TXT and MX records are always "DNS only". If an email service ever gives you a CNAME for DKIM (some do), set it to DNS only (grey cloud). A proxied DKIM CNAME points at Cloudflare's servers instead of the key, and DKIM fails.
- Long TXT values. Cloudflare stores a long DKIM key correctly as one value; paste it whole, without adding your own quotes or splitting it.
- One SPF record per name. If your domain's root already has an SPF record (for Google Workspace or Microsoft 365, for example), don't add a second one there. The records above are on subdomains, so they don't collide with it.
- Email Routing. If you use Cloudflare Email Routing for addresses at your root domain, its MX and SPF records stay as they are. Sending from
notify.example.comdoesn't touch them.
Check that it worked
Cloudflare changes are usually live within a minute or two. Then:
- Run the free domain checker on your domain to see each record as mailbox providers see it.
- Click Verify in your email service.
If a record isn't found, check for a typo in the name (for example _dmarc written as dmarc) and that the DKIM content wasn't cut short.
The faster way: let TrivSend add them
For a domain on Cloudflare, TrivSend can add all four records for you. You create a Cloudflare API token limited to that one zone's DNS, paste it once, and TrivSend adds only its own records: it merges an existing SPF record instead of overwriting it, keeps an existing DMARC record, and tells you about any clash. The token is used once and never stored.
Next steps
- SPF, DKIM and DMARC explained covers what each record does and why.
- Move DMARC from
p=nonetoquarantineonce reports show your mail passing. The DMARC generator builds the record. - Sending at volume? Read the Gmail, Yahoo and Outlook sender requirements.
Start free with TrivSend: 3,000 emails a month, with DNS set up for you on Cloudflare.