MailKite DNS on Cloudflare
Cloudflare supports all four DNS records MailKite requires — one MX and three TXT records (SPF, DKIM, DMARC) — added under your zone → DNS → Records → Add record. One thing to check first: if Cloudflare Email Routing is enabled it manages your MX records, and you'll need to disable it before pointing MX at MailKite.
Before you start
- Add your domain in MailKite to get the exact record values — the DKIM key is unique per domain.
- If Email Routing is on (zone → Email → Email Routing), disable it — Cloudflare locks the zone's MX records while it's active. Your MailKite webhook + routes replace what it did.
The records, Cloudflare-style
Cloudflare's Name field accepts the host part —
@ means the zone root. Values below are for
myapp.ai:
| Type | Name | Content | Priority | TTL |
|---|---|---|---|---|
MX | @ | mx.mailkite.dev | 10 | Auto |
TXT | @ | v=spf1 include:mailkite.dev ~all | — | Auto |
TXT | mailkite._domainkey | v=DKIM1; k=rsa; p=… (from your dashboard) | — | Auto |
TXT | _dmarc | v=DMARC1; p=none; | — | Auto |
For a subdomain likemail.myapp.ai, the Names becomemailkite._domainkey.mail, and_dmarc.mail.
Step by step
- Open dash.cloudflare.com and select your zone.
- Go to DNS → Records and click Add record.
- Add each of the four records above. MX and TXT records are always DNS-only — the orange-cloud proxy doesn't apply to them.
- Save. Cloudflare publishes changes near-instantly.
Automate it (optional)
Cloudflare's API makes this scriptable — one POST per record
with a zone-scoped
API token:
# One call per record; MX also takes "priority".
curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records" \
-H "Authorization: Bearer $CF_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{ "type": "MX", "name": "myapp.ai", "content": "mx.mailkite.dev", "priority": 10, "ttl": 1 }' Verify
npx @mailkite/cli domains verify <domainId> --json
Cloudflare propagates in seconds to minutes — usually the
fastest of any provider. The domain flips to verified once MX
resolves; re-run until SPF, DKIM, and DMARC are green too.
Cloudflare gotchas
- Email Routing owns MX. While Email Routing is enabled, Cloudflare manages the zone's MX and SPF records and your custom MX won't take effect. Disable it under Email → Email Routing → Settings first.
- One SPF record per name. If
@already has av=spf1TXT, addinclude:mailkite.devto it rather than creating a second record. - Don't proxy mail hosts. If the same subdomain also has A/AAAA records, the proxy on those doesn't affect MX/TXT — but a CNAME at the same name conflicts with them entirely. Remove it.
- Quotes are handled for you. Paste TXT values without surrounding quotes; Cloudflare adds them.
FAQ
Does Cloudflare allow the DNS records MailKite requires?
Yes. MX and TXT are core record types on every Cloudflare
plan, including Free. The only interaction to know about is Cloudflare Email
Routing, which must be off so your MX record can point at
mx.mailkite.dev.
Can I use MailKite alongside Cloudflare Email Routing?
Not on the same domain — a domain's MX records can only point at one inbound
provider. Use MailKite on a subdomain (mail.myapp.ai) if you
want to keep Email Routing on the root, or replace Email Routing entirely
with MailKite webhooks and routes.
How fast does Cloudflare DNS propagate?
Changes are live on Cloudflare's edge in seconds; global resolver caches catch up within minutes. Verification usually succeeds on the first try.
Next: receive your first message, or see the full Domains & DNS reference.