Websites survive a sloppy DNS migration because a missing A record is obvious within minutes. Mail does not — a dropped DKIM record or a proxied MX target fails quietly, and you find out days later when a customer asks where a week of invoices went. The safe sequence is: export the complete zone from cPanel, import it into Cloudflare, force every mail and service record to DNS-only, prove the Cloudflare copy answers identically to the cPanel copy, and only then change nameservers at the registrar. The cPanel zone stays untouched until the delegation has fully moved.
What’s happening
When you add a domain to Cloudflare, its quick scan guesses at your records. It is best-effort by design: it reliably finds the apex A record, www, and MX, and it routinely misses DKIM selectors (default._domainkey), _dmarc, SRV records, and cPanel service subdomains like mail, webmail, and cpanel that only exist in the local zone. Anything the scan misses simply stops resolving the moment the registrar delegation lands on Cloudflare.
The second trap is proxy status. Cloudflare only proxies HTTP and HTTPS. If the A record your MX points at gets the orange cloud, sending servers resolve it to Cloudflare edge IPs, try to open port 25, and get nothing. They queue and retry for days before bouncing, so the failure surfaces slowly. The full list of records that must stay grey is in cPanel service records that must stay DNS-only.
Nothing about mail routing changes on the cPanel side: the box still hosts the mailboxes, the domain stays in /etc/localdomains, and Exim behaves exactly as before. Only the authority over the zone moves.
What to check first
Inventory every record mail depends on before touching anything: the MX record and the A record it points to, the SPF TXT at the apex, default._domainkey, _dmarc, autodiscover and autoconfig entries, and the mail and webmail hosts. Also confirm whether the domain has DNSSEC enabled — a DS record at the registry that no longer matches the new nameservers takes the whole domain offline, so DNSSEC must be removed at the registrar (or re-established with Cloudflare’s keys) as part of the cutover.
How to verify
Pull the zone exactly as cPanel serves it today:
# Full zone as the cPanel server publishes it
whmapi1 dumpzone domain=example.com
# Or read the raw BIND file
cat /var/named/example.com.db
Snapshot what the world currently resolves, so you have a baseline:
dig +short MX example.com
dig +short A mail.example.com
dig +short TXT example.com
dig +short TXT default._domainkey.example.com
dig +short TXT _dmarc.example.com
dig +short DS example.com
After building the zone in Cloudflare, query the assigned Cloudflare nameservers directly — before the registrar change, while there is still nothing to break:
# Parity check against the assigned Cloudflare nameservers
dig @ada.ns.cloudflare.com +short MX example.com
dig @ada.ns.cloudflare.com +short A mail.example.com
dig @ada.ns.cloudflare.com +short TXT default._domainkey.example.com
Every answer must match the baseline. A record that resolves to 104.x or 172.6x.x.x instead of your server IP is proxied and needs its cloud turned grey if mail or a service depends on it.
The fix
- Export the zone from cPanel. Use
whmapi1 dumpzoneor copy the file from/var/named/. Do not work from memory or from the quick scan alone. - Add the domain in Cloudflare and import the zone file. In the dashboard, DNS » Records » Import and Export accepts the BIND file directly. Review what the import flagged or skipped. The Free plan is fine for all of this — nothing in a standard cPanel cutover needs a paid feature.
- Audit proxy status record by record. Web records (
@,www, application subdomains) can be proxied if that is the goal.mail,webmail,cpanel,autodiscover,autoconfig,ftp, the server hostname, and above all the MX target must be DNS only. - Confirm Email Routing is off. Cloudflare’s Email Routing rewrites your MX records to its own the moment it is enabled. The mailboxes live on the cPanel server; leave the feature alone.
- Run the parity check shown above until Cloudflare’s answers match cPanel’s for every record type you care about.
- Clear DNSSEC if present. Remove the DS record at the registrar and wait for it to expire from caches before switching, or plan to enable DNSSEC fresh on Cloudflare afterwards.
- Change the nameservers at the registrar to the assigned pair. Registry NS TTLs are typically 24–48 hours, and you cannot lower them — plan for a window where both providers answer.
- Watch mail land during the transition. Both zones answer identically, so there is no wrong answer to receive — but confirm it:
tail -f /var/log/exim_mainlog
- Leave the cPanel zone in place for at least a week. Resolvers with cached NS records will keep asking the old server. Deleting the zone early creates exactly the outage you worked to avoid.
When this fix is wrong
If mail is hosted remotely — Microsoft 365, Google Workspace — the checklist shifts: the MX, SPF, and DKIM records belong to that provider, and your job is to carry them across unchanged, not to point them at the cPanel box. And if you are changing servers at the same time as changing DNS providers, stop: do one migration, verify it, then do the other. Two simultaneous cutovers make every symptom ambiguous.
Common mistakes
Trusting the quick scan and skipping the zone export. Proxying the MX target because orange looks like protection. Enabling Email Routing “while you’re in there.” Deleting the cPanel zone the same afternoon. Forgetting DKIM, then wondering why DMARC reports show failures a week later. Editing records on the cPanel side after the cutover and wondering why nothing changes — Cloudflare is authoritative now.
Prevention
Keep the dig baseline in the ticket, re-run the same queries 24 hours and one week after cutover, and diff. Document which side owns DNS for every domain on the server so the next admin edits the zone that actually answers. See Cloudflare’s DNS documentation for zone import details, and Cloudflare in front of cPanel in DNS-only mode for what the finished architecture looks like.
Running Cloudflare in front of cPanel/WHM is a stack Stack Harbor operates daily as an official cPanel NOC partner — cPanel/WHM management covers the DNS, mail, SSL, and firewall plumbing, and you can start a conversation any time.