---
title: "SPF, DKIM and DMARC on Cloudflare: setup guide | sendmcp"
url: https://sendmcp.dev/spf-dkim-dmarc-cloudflare/
description: "Set up SPF, DKIM and DMARC on Cloudflare: what each record does, how to add them by hand, and how your agent writes and verifies all three through the API."
---

[Features](https://sendmcp.dev/features/) · SPF, DKIM, DMARC

# How do I set up SPF, DKIM and DMARC on Cloudflare?

To set up SPF, DKIM and DMARC on Cloudflare, add 3 DNS records to your zone: SPF lists who may send for your domain, DKIM publishes the key that checks each message's signature, and DMARC tells receivers what to do when both fail. With sendmcp your agent writes all three through the Cloudflare API and checks alignment on a test send.

Updated Nov 23, 2026 · Open source, [runs on your Cloudflare account](https://sendmcp.dev/#pricing)

Agent

Add acme.com and set up SPF, DKIM and DMARC.

**acme.com is ready to send.** I wrote the records to your Cloudflare zone and checked them. Google Workspace also sends as acme.com, so DMARC starts at `p=none` with reports sent to you, and nothing from Workspace gets refused.

Records for acme.com

**SPF** TXT record, sending allowed for Cloudflare

 pass

**DKIM** TXT record with the signing key

 pass

**DMARC** TXT record, policy none

 pass

Send a test email Raise DMARC to quarantine later

## What do SPF, DKIM and DMARC each do?

| Record | DNS type | What it proves |
| --- | --- | --- |
| SPF | TXT on your domain | The sending server is allowed to send for your domain |
| DKIM | TXT under a `_domainkey` name | The message was signed with your key and not changed on the way |
| DMARC | TXT on `_dmarc` | SPF or DKIM passes and matches your From domain; sets the policy and where reports go |

Receivers such as Gmail check them on every message. A missing or failing record is a common reason mail lands in spam or bounces.

## How do I add them by hand on Cloudflare?

1. Check whether `_dmarc` already has a record. If it has none, Cloudflare adds `v=DMARC1; p=reject;` when you onboard the domain, and any other service that sends as your domain without alignment gets refused.
2. Add the domain to Cloudflare Email Sending. The dashboard shows the DNS records for it.
3. Add the SPF and DKIM records to the zone under DNS, exactly as shown, and wait for verification.
4. If other services send as your domain, add a DMARC record that only monitors before you add the domain in step 2, so Cloudflare keeps it instead of adding its own:

# DNS, TXT record _dmarc.acme.com TXT "v=DMARC1; p=none; rua=mailto:dmarc@acme.com"

Start with `p=none` and read the reports. Once real mail passes, move to `quarantine` and then `reject`. If nothing else sends as the domain, such as a new domain or a sending subdomain, keep Cloudflare's `p=reject`.

## How does my agent do it?

Cloudflare shows you the records and leaves the copying to you. Resend has an Auto configure button that signs in to your DNS provider. sendmcp runs inside your Cloudflare account, so your agent writes the records over MCP with no sign-in step, and it also writes DMARC and the tracking CNAME.

| Step | Tool |
| --- | --- |
| Add the domain and write SPF, DKIM, DMARC and the tracking CNAME | `domains_add` |
| Check that the records resolve | `domains_verify`, `domains_dns_records` |
| Check DNS, DMARC policy, suppression count and complaint rate | `deliverability_check` |
| Send a test and read the result | `emails_send_test`, `events_list` |

Alignment is checked on the test send, not only in DNS.

## Which DMARC policy should I use?

`p=none` reports and blocks nothing. `quarantine` sends failing mail to spam, and `reject` refuses it. `deliverability_check` shows the policy for each domain, so your agent can tell you which ones are still on `none`.

sendmcp picks the starting policy from what is already in your zone:

| Your domain | What sendmcp does |
| --- | --- |
| Has a DMARC record | Leaves it as it is |
| No DMARC record, and other services send as it (MX records or other `include:` entries in SPF) | Writes `p=none` with reports to you before onboarding, so Cloudflare does not add `p=reject` |
| No DMARC record, and nothing else sends as it | Keeps Cloudflare's `p=reject` |

On a domain that starts at `p=none`, `deliverability_check` reads the reports. When every sender passes with alignment, your agent suggests `quarantine`, then `reject`. It never changes the policy without asking.

## Sources

1. [Cloudflare: Email Service docs](https://developers.cloudflare.com/email-service/) checked Nov 23, 2026
2. [Resend docs](https://resend.com/docs/llms.txt) checked Nov 23, 2026

## Questions about this

### Do I need all three records?

Set all three. SPF and DKIM prove who sent the mail, and DMARC tells receivers what to do when they fail. sendmcp writes all three when you add a domain.

### Why does sendmcp start some domains at p=none?

Because Cloudflare's default `p=reject` refuses mail from any other service that sends as your domain without alignment, such as Google Workspace or a CRM. When sendmcp finds other senders, it starts at `p=none` with reports and suggests a stricter policy once they pass. A domain that only sends through Cloudflare keeps `p=reject`.

### Why is my domain stuck on pending?

The records usually need time to propagate. Ask your agent to run `domains_verify` again, and check with `domains_dns_records` that each record exists in the zone.

### Does passing all three guarantee inbox delivery?

No. They prove you are who you say you are. Inbox placement also depends on your content, your list and Cloudflare's shared IP reputation, so sendmcp makes no deliverability guarantee.

## Related questions

### Why did my email bounce, and how do I fix it?

bounce_explain reads the SMTP response and names the cause and the fix.

[Why did my email bounce, and how do I fix it?](https://sendmcp.dev/why-did-my-email-bounce/)

### How do I send email from many domains with one account?

One Worker, a key per project, no per-domain fee.

[How do I send email from many domains with one account?](https://sendmcp.dev/email-for-multiple-domains/)

### Is there an email MCP server for Claude, Cursor and ChatGPT?

resend-mcp and sendmcp compared, and how to connect your agent.

[Is there an email MCP server for Claude, Cursor and ChatGPT?](https://sendmcp.dev/email-mcp-server/)

## Send from every project for $0.

Open source. One click puts it on your Cloudflare account.

[Deploy to Cloudflare](https://deploy.workers.cloudflare.com/?url=https://github.com/agentfirsthq/sendmcp)
