Cloudflare DNS Setup for Your Business Website and Email

Cloudflare DNS Setup for Your Business Website and Email

Configure Cloudflare DNS for your business website and email. Check A, CNAME, MX, SPF, DKIM and DMARC records, proxy settings and delivered-message results.

To configure Cloudflare DNS for a business domain, publish the website and email records supplied by your providers, keep mail hostnames out of the standard HTTP proxy, then test both DNS and delivered messages. Changing DNS does not by itself configure a mailbox, enable DKIM signing or establish DMARC alignment.

This guide covers authoritative DNS for a domain you manage in Cloudflare. It is for connecting a business website and email services, rather than changing the DNS resolver on your laptop.

TL;DR:

  • Inventory the existing records before changing them.
  • Copy domain-specific email values from your actual providers.
  • Check the proxy status of mail and verification hostnames.
  • Verify the website, incoming email and every outgoing mail stream separately.

For authentication concepts and provider setup, use our SPF, DKIM and DMARC guide. The Gmail and Yahoo requirements overview explains when the receiving providers’ rules apply.

Collect the Values Before Editing DNS

Record who controls the registrar, Cloudflare account, web hosting and mail services. Make sure the business can access those accounts and that someone is responsible for approving the change.

Export or record the current zone, including website, mail, verification and any SRV or CAA records your services use. For each proposed change, save the old value, the new provider-supplied value and the service that depends on it. Treat deletion as a separate decision from adding a new record.

If Cloudflare already hosts the active zone, changing a record does not normally require changing nameservers again. If you are moving the domain into Cloudflare, follow its full-setup procedure: review the imported records, use the assigned nameservers and handle existing DNSSEC before the switch.

Cloudflare’s standard migration procedure calls for disabling existing DNSSEC at the registrar before replacing nameservers, then enabling it through Cloudflare once the zone is active. A stale DS record can make the domain fail validation. Follow the documented migration path appropriate to your setup. For the concepts, see DNSSEC and CDNs explained.

Match Each Record to Its Job

RecordBusiness purposeWhere the value comes from
A or AAAAResolve a hostname to an IPv4 or IPv6 addressYour web or mail host
CNAMEPoint a hostname to another DNS nameYour hosting, verification or email provider
MXIdentify where incoming mail should be deliveredThe receiving mail provider, including priority values
TXT for SPFPublish the sending sources authorized for that hostnameYour legitimate sending services
TXT or CNAME for DKIMPublish or point to the public signing keyThe email provider’s selector and domain-specific value
TXT for DMARCPublish the domain’s authentication policy and reporting destinationThe policy you have chosen for that domain

Cloudflare documents these types in its DNS record reference. Match the record’s purpose before copying a value: a website address, mailbox destination and DKIM target are not interchangeable.

Add the Website Records

Open the domain in Cloudflare and go to DNS → Records. Add or edit the A, AAAA or CNAME values supplied by your hosting provider. Check both the root domain and www if your website uses them.

For each record, verify the final hostname, record type, content, TTL and proxy setting. Keep only the IPv6 records that point to a working IPv6 service. A correct IPv4 address does not fix a stale IPv6 destination.

Use the proxy mode that your hosting arrangement supports. Cloudflare’s proxy applies to eligible A, AAAA and CNAME records; DNS-only records return the underlying destination without placing HTTP traffic through the proxy. Proxy behavior.

After saving, test the expected website addresses over HTTPS. Check redirects, certificates and an important business action such as opening the contact form. A successful DNS lookup alone does not test those parts of the service.

Publish Email Records From the Actual Provider

Use the provider’s domain setup screen, rather than a generic list of records. Tenant-specific DKIM targets and product-specific instructions can change. Cloudflare’s record-management instructions cover the interface; your email provider supplies the values.

MX for Incoming Mail

Copy all required MX destinations and their priorities. Check which service should receive mail before replacing an existing MX set. Multiple records can be intentional when they belong to the same documented delivery configuration.

If Cloudflare Email Routing is enabled, it can manage MX records that conflict with a different receiving provider. Check that feature when the visible records differ from the mailbox provider’s instructions. Cloudflare email troubleshooting.

SPF for Authorized Sending Sources

Check the existing TXT records at the hostname before adding SPF. Maintain one record beginning v=spf1 there, incorporating the legitimate sending services according to their instructions. Other TXT records used for verification can coexist.

Two separate SPF policies at the same hostname do not provide a safe way to add a second sender. The protocol specifies a single selected SPF record. RFC 7208, section 3.2.

Record every production sender: employee mail, newsletters, invoices, support systems and application notifications. Their envelope domains and DKIM domains can differ, so their authentication configuration needs separate checks.

DKIM for Signed Mail

Copy the selector, hostname and exact TXT value or CNAME target from the sending provider. Some services require more than one selector for rotation. Enable signing in the provider once its DNS checks pass.

Set a provider-verification or DKIM CNAME to DNS-only when the provider requires the original target. If verification fails, compare the hostname and returned record with the provider’s expected values before adding another record.

DMARC for Policy and Reporting

Publish the policy at the correct _dmarc hostname. For a domain beginning a monitoring rollout, an example is:

v=DMARC1; p=none; rua=mailto:[email protected]

Replace the example domain with a reporting destination you control and configure any required external reporting authorization. Monitoring provides evidence for later policy decisions. The DMARC rollout section explains current standards and receiver-compatibility considerations.

Keep Mail Hostnames DNS-Only

MX and TXT records are always DNS-only in Cloudflare. Also inspect any A, AAAA or CNAME hostname used by mail clients or targeted by MX: changing that hostname’s proxy status can affect the connection.

Cloudflare’s standard HTTP proxy does not carry SMTP, IMAP or POP3. A mail hostname returned as a Cloudflare proxy address can therefore prevent clients from connecting to the mail service. Mail hostname and proxy troubleshooting.

Keep the website’s proxy decision separate from the mail hostname’s configuration, even when both services use the same underlying server.

Verify DNS and Delivered Messages

Replace example.com with your domain in these read-only lookups:

dig +short NS example.com
dig +short A example.com
dig +short AAAA example.com
dig +short MX example.com
dig +short TXT example.com
dig +short TXT _dmarc.example.com

For DKIM, query the selector supplied by the provider, for example selector1._domainkey.example.com, using the appropriate TXT or CNAME type. Compare the answers with the saved expected values. Cached answers can persist according to TTL; Cloudflare explains TTL and cached responses.

Then test the actual services:

  1. Open the root website and www over HTTPS, where configured.
  2. Receive a message at the business mailbox.
  3. Send from each production sending service to a test recipient.
  4. Inspect the delivered message’s SPF and DKIM results and the domains involved.
  5. Check DMARC alignment with the visible From domain.
  6. Confirm that the team knows where delivery logs and later DMARC reports can be reviewed.

A published DKIM key does not establish that the provider is signing real messages. A passing signature for a different domain also needs the alignment check described in the authentication guide.

Troubleshoot the Failing Layer

SymptomCheck first
Website fails after a nameserver changeActive nameservers, complete zone records and DNSSEC/DS consistency
Incoming mail stopsProvider MX values and whether Email Routing changed the receiving configuration
Mail client cannot connectMail hostname resolution and DNS-only setting
A provider cannot verify a CNAMEExact hostname and target, proxy status and any relevant CNAME flattening setting
DKIM is published but messages failSigning enabled at the sender, actual selector and delivered-message results
DMARC fails despite SPF or DKIM passingAlignment between the authenticated domain and the visible From domain

For CNAME verification, Cloudflare notes that flattening can affect services expecting the CNAME target itself. Review its CNAME flattening guidance.

Keep the before-and-after values and test results with the domain’s access documentation. If you need help untangling ownership, hosting and email configuration, contact us with the services involved and the exact symptom.

Frequently Asked Questions

Does using Cloudflare DNS create an email mailbox?
No. DNS publishes records that direct traffic and support authentication. Configure the mailbox or sending service separately, then publish the exact records it supplies.
Should email DNS records use the orange cloud?
MX and TXT records are always DNS-only. Mail-related A, AAAA and CNAME hostnames must also use the setting required by the mail provider, normally DNS-only. Cloudflare’s standard HTTP proxy does not carry SMTP, IMAP or POP3.
Can my domain have two SPF records?
Do not publish two TXT records beginning v=spf1 at the same hostname. Review the legitimate senders and maintain one SPF policy for that hostname. Unrelated TXT verification records can coexist.
Does a DNS lookup prove that email authentication works?
No. It shows published DNS data. Send through every real sending service and inspect the delivered message for the signing domain, SPF identity and DMARC alignment.
Should I copy MX and DKIM records from an online example?
Use the exact values from your provider’s setup screen for your domain. Examples can belong to another tenant, product or configuration.