DNS Guide: Cloudflare

Step-by-step instructions for adding AgentMail DNS records in Cloudflare.

Steps

  1. Log in to the Cloudflare dashboard
  2. Select your domain
  3. Go to DNS, then click Records
  4. Click Add Record for each record AgentMail requires

Adding a TXT Record (SPF)

FieldValue
TypeTXT
Name@ (or your subdomain)
ContentThe SPF value from AgentMail (e.g., v=spf1 include:agentmail.to ~all)
TTLAuto

If you already have an SPF record for your domain, do not create a second one. Instead, add include:agentmail.to to your existing SPF record. Having multiple SPF records on the same domain will cause authentication failures.

Adding a TXT Record (DKIM)

FieldValue
TypeTXT
NameThe DKIM selector host from AgentMail (e.g., selector._domainkey)
ContentThe DKIM TXT value from AgentMail
TTLAuto

Cloudflare automatically strips your domain from the Name field. Enter only the selector host portion (e.g., selector._domainkey), not the full selector._domainkey.yourdomain.com.

Legacy orgs should keep existing working DNS records in place. For new domain setup, add the TXT selector records shown in AgentMail.

Adding an MX Record (Receiving)

FieldValue
TypeMX
Name@ (or your subdomain)
Mail serverThe MX target from AgentMail
Priority10
TTLAuto

If you want to receive emails on a subdomain to avoid conflicts with your existing email provider, enter the subdomain instead of @ in the Name field.

Verification

After adding all records, go back to the AgentMail Console and click Verify Domain.

Cloudflare DNS typically propagates within 1 to 5 minutes, making it one of the fastest providers for DNS updates.

Common Cloudflare Issues

  • Existing SPF record: If you already have a TXT record starting with v=spf1, add include:agentmail.to before the ~all or -all in that existing record. Do not create a second SPF TXT record.

  • Duplicate TXT values: Cloudflare lets you add TXT records with the same name, but duplicate SPF or stale DKIM selector records can make verification fail. Keep only the current values AgentMail provides for each host.

  • Name field auto-strips domain: Cloudflare removes the domain portion from the Name field automatically. If your DKIM selector is selector._domainkey, enter just that. Do not enter selector._domainkey.yourdomain.com, or the record will be created incorrectly.