Pointing a domain’s nameservers at Cloudflare is a routine operation until email stops arriving. The failure is rarely dramatic: a few senders get bounces, others report mail that vanishes, and someone notices a week later that invoices never showed up. The cause is almost always the same. The nameserver change went through before the existing MX, SPF, and DKIM records were copied into the Cloudflare zone, and for the length of the propagation window the domain advertised no usable mail configuration at all. If you plan to use Cloudflare email forwarding or a full Cloudflare Email Routing setup, the order of operations matters more than any single setting.
This checklist is written for the person holding the registrar login, not for a support ticket. It covers what to copy before delegation, how to verify the zone is complete, and which Cloudflare Email Routing limits and post-switch checks catch the silent failures that never generate an error message. Cloudflare Email Routing forwards email for domains using Cloudflare DNS, and it requires nameservers pointing to Cloudflare before any routing rule becomes active. That dependency is exactly why the migration has to be sequenced: Cloudflare adds MX, SPF and DKIM records to the zone, but it cannot import what you never copied, and it will not warn you about a mail provider you left behind.
Treat the nameserver switch as the last step, not the first. Everything below assumes the goal is zero lost mail, not a fast cutover.
Why Nameserver Changes Break Email Before DNS Propagation Finishes
A nameserver change is not a switch, it is a handover with a window. When you point a domain at Cloudflare, you replace the authoritative source of every record in the zone: A, AAAA, CNAME, MX, TXT. The moment the registrar publishes the new nameserver set, resolvers that have never queried the domain before will go straight to Cloudflare and ask for the MX record. If that record does not exist in the Cloudflare zone yet, the answer is NXDOMAIN or an empty response, and the sending mail server treats it as a hard bounce. Mail is not queued for later delivery at that point. It is rejected.
The propagation part makes this worse because the change is never simultaneous. The parent zone lists your new nameservers with a TTL that can run from minutes to 48 hours, and every recursive resolver in the path caches what it last learned. One ISP resolver may still hold the old NS set and keep asking your previous DNS provider, where the MX records are intact and mail flows. Another resolver, five minutes later, asks Cloudflare and finds nothing. Two users on the same domain get different results, which is why the first reports of lost mail look random and get dismissed as a client problem.
Record TTLs add a second layer of caching. Your old MX record might have a 3600 second TTL, and resolvers that fetched it before the cutover will keep using it until it expires. That sounds helpful, and it is, but only for senders whose resolvers already cached the record. A sender that has never emailed you, or whose cache was flushed, hits the new nameservers cold. First contact after a nameserver change is exactly the scenario where a missing MX record does the most damage, because it is usually a new correspondent or a transactional provider with no retry logic worth relying on.
SPF has the same failure shape with a quieter symptom. SPF lives in a TXT record, and if the TXT record is not present in the new zone, receivers evaluate the sender against no policy. Depending on the receiving side, that means either a pass with no alignment or a soft fail that lands in spam. Nothing bounces, so nobody notices for days, and by then the domain’s sending reputation has taken the hit.
Cloudflare adds MX, SPF and DKIM records when you enable Email Routing, but only for the records it manages, and only after the zone is active. That is the trap: the zone becomes active the instant nameservers change. Get the records into the Cloudflare zone before the registrar update, verify them with a query against the assigned Cloudflare nameservers directly, and the handover becomes invisible to senders.
The Costly Mistake: Switching Nameservers Before Recreating MX, SPF, and DKIM Records
Nameserver delegation is a single, atomic change on the registrar side, but it is not a single change in DNS. The moment the new nameservers answer queries, every lookup for your zone comes from Cloudflare’s copy of it. If that copy has no MX record, mail servers get a null MX answer or no answer at all. If it has no SPF record, receivers fall back to a bare HELO check and your legitimate mail starts landing in spam or getting rejected outright. DKIM is worse: a missing selector record means every signed message fails verification silently, and some receivers treat that as a stronger signal than a missing SPF record.
The failure is asymmetric and easy to underestimate. Inbound mail to a domain with no MX record bounces with a 550 or gets queued by the sender and retried for days, then bounces. Senders see a hard failure and their users see a delivery status notification. Outbound mail keeps leaving your mail provider, but receivers querying your zone for SPF and DKIM hit Cloudflare, get nothing, and score the message accordingly. Nothing in the Cloudflare dashboard warns you that a zone is live with zero mail records. The zone looks healthy because the website resolves.
The fix is ordering, not recovery. Before you touch nameservers, get the records into Cloudflare’s DNS tab and confirm they are proxied or DNS-only as appropriate. MX and TXT records cannot be proxied, so leave them gray-clouded. Then list what you need to carry over:
- Every MX record with its exact hostname and priority. Priority matters: if your provider uses 10 and 20 for primary and backup, flipping them sends mail to the wrong host.
- The SPF TXT record at the apex, copied character for character, including all include: mechanisms. A truncated SPF record that exceeds the 10-lookup limit fails permanently.
- Every DKIM selector TXT record, at the exact selector hostname your provider publishes, for example selector1._domainkey or google._domainkey. Ask the provider for the current selector if you are unsure; old selectors get rotated.
- The DMARC record at _dmarc, plus any verification TXT records for third-party tools that send mail on your behalf.
- Any CNAME records that mail platforms use for tracking or domain verification, which are easy to miss because they look like web records.
Cloudflare’s DNS scan pulls records it can find from your current authoritative servers, but it is a starting point, not a guarantee. Compare the scan against a direct query of the old nameservers with dig or a DNS checker before you delegate. If the lists match, switch. If they do not, fix the gap first, because once the registrar propagates the change you are debugging production mail with real bounces.
How to Copy or Import Existing DNS Records into Cloudflare Before the Switch
When you add a zone in the Cloudflare dashboard, Cloudflare runs a scan against your current authoritative nameservers and pre-populates the DNS tab with what it finds. That scan is a starting point, not a guarantee. It frequently picks up A, AAAA, and CNAME records cleanly but misses or mangles longer TXT strings, multi-record SPF policies, and DKIM keys split across two quoted chunks. Treat the import result as a draft that needs review, not as a finished copy.
Before you touch anything in Cloudflare, export your live zone from the current provider. Most registrars and DNS hosts offer a BIND-format zone file export, and cPanel, Route 53, and GoDaddy all expose one. If yours does not, pull the records manually: on Linux or macOS, dig MX example.com +short, dig TXT example.com +short, and dig TXT selector1._domainkey.example.com +short give you the exact strings resolvers see right now. Save the output to a file, as explained at https://allmail.one/blog/cloudflare-email-forwarding/, since this is your source of truth if the scan disagrees with reality.
Manual entry is where the details matter. MX records need both the hostname and the priority preserved (10 mail1.provider.com, 20 mail2.provider.com, and so on); a dropped priority changes failover order silently. For SPF, paste the full TXT value including the v=spf1 prefix, and if the policy exceeds 255 characters, split it into two quoted strings exactly as the original does. DKIM records go under the selector hostname your mail provider issued, not at the apex, and the p= value must be copied without line breaks. DMARC lives at _dmarc.example.com and should be copied verbatim, including any rua= and pct= tags. Cloudflare adds its own MX, SPF, and DKIM records if you later enable Email Routing, so keep the mail provider’s set intact until you have decided which system handles inbound mail.
Run this checklist before you change nameservers at the registrar:
- Every MX record from the export exists in Cloudflare with the same host and priority.
- SPF TXT string matches character for character, including mechanism order.
- Each DKIM selector is present under the correct hostname and validates with a DKIM checker.
- DMARC record is at _dmarc with the same policy tag.
- Any verification TXT records (Google, Microsoft, domain ownership) are copied.
- TTL values are set to 300 seconds or lower so a rollback is fast.
- Cloudflare shows the zone as Active only after nameserver delegation completes, and the DNS tab has no orange-cloud proxy on mail-related hostnames.
| Method | What it covers | Trade-off |
|---|---|---|
| Automatic scan on zone add | Common A, AAAA, CNAME, and simple TXT records | Fast, but often misses long TXT and DKIM chunks; always verify |
| BIND zone file import | Full record set including MX priorities and multi-string TXT | Most accurate if your host exports one; requires a clean file |
| Manual entry from dig output | Exactly what public resolvers return | Slow and error-prone for large zones, but reliable for mail records |
| Provider migration tool or API | Bulk records via Cloudflare API or partner tools | Good for many domains; needs scripting and a diff check afterward |
Compare the Cloudflare DNS tab against your export line by line, not by eyeballing counts. A zone with 40 records where 38 match still breaks mail if the two missing entries are the DKIM selector and the DMARC policy.
Cloudflare Email Routing Setup and Forwarding to Gmail After the Migration
Once your DNS records are in Cloudflare and the nameservers point there, Email Routing becomes an option. Open the Cloudflare dashboard, select the domain, and go to Email > Email Routing. Cloudflare adds MX, SPF and DKIM records for you, but it will refuse to enable routing while MX records for another mail provider still exist on the zone. That conflict is the most common reason the setup stalls after a migration. Decide first whether the domain receives mail through Cloudflare Email Routing or through your old host, then remove the losing set of MX records before you click Enable.
The practical sequence for email forwarding to Gmail looks like this:
- Add your Gmail address under Destination addresses and click the verification link Google receives. Destination addresses must be verified before rules activate; unverified targets leave rules inert and mail quietly bounces.
- Create routing rules. Custom addresses map one mailbox to one destination, for example support@yourdomain.com to you@gmail.com. Each routing rule supports one destination address, so fan-out requires separate rules.
- Add a catch-all rule if you want anything unmatched to land in Gmail. Catch-all catches addresses not matched by other rules, which is useful for typo traffic and aliases you have not documented, but it also collects spam aimed at random local parts.
- Confirm the MX records Cloudflare inserted (route1.mx.cloudflare.net, route2.mx.cloudflare.net, route3.mx.cloudflare.net) and their priorities. If you keep a third-party mail provider for some subdomain, its MX records belong on that subdomain, not on the apex.
Check the SPF record while you are in the DNS tab. If your old provider left v=spf1 include:… entries behind, they do nothing for inbound forwarding but can break outbound authentication later. Cloudflare Email Routing does not support sending or replying from the domain, so replies sent from Gmail carry your Gmail address unless you configure a separate sending path. Cloudflare Email Service groups Email Routing and outbound sending, so if you need to send as your domain, plan that separately from forwarding.
If the domain already had DKIM selectors published for the previous provider, leave them in place until you confirm nothing signs mail with them. Deleting a DKIM selector mid-migration invalidates signatures on mail still in flight and pushes messages into spam or rejects them outright. Then run a live test: send from an external account to a routed address and to a random address covered by catch-all, and check the Gmail inbox and the Email Routing activity log in the dashboard. The log shows delivered, dropped and rejected messages per rule, which is the fastest way to confirm the migration did not silently break inbound mail.
Cloudflare Email Routing Limits and Post-Switch Checks That Prevent Silent Failures
Know the Caps Before You Build Rules
Cloudflare Email Routing is generous for small and mid-size domains, but the ceilings are real and they bite quietly. Plan around these numbers:
- Routing rules per domain: 200. Each routing rule supports one destination address, so 200 rules is also your practical ceiling for mapped aliases.
- Destination addresses: up to 200 per account, and each one must be verified before the rules pointing at it activate. Unverified destinations leave rules dormant with no bounce to warn you.
- Message size limit: 25 MiB. Anything larger is rejected, which matters if clients send scanned PDFs or raw photo sets.
- Catch-all rule: one per domain, and it catches every address not matched by other rules. Enable it deliberately, because it is also a spam magnet.
Also note what Email Routing does not do: it does not support sending or replying from your domain. Outbound mail needs Cloudflare Email Service (which groups Email Routing and outbound sending), a Worker email processing setup, or your original provider kept in place for SMTP.
Verify Every Destination Address First
Open the Cloudflare dashboard, go to Email Routing, then Destination addresses, and confirm the status column reads verified for each Gmail or mailbox target. The verification email lands in that inbox, so if you are forwarding to a Gmail address you have not touched in months, log in and click the link before you announce the migration. Then check each routing rule: a rule whose destination shows unverified will not forward. If a rule needs to go to two people, create two rules, since one rule equals one destination.
Run These Tests After the Switch
- Send from an external account to each mapped alias and to a random address if catch-all is on. Confirm arrival in Gmail within a minute or two.
- Send a message with a 20 MB attachment and one over 25 MiB. The first should arrive; the second should be rejected cleanly.
- Check the Email Routing activity log in the dashboard for the test messages. Missing entries mean the MX records are not resolving to Cloudflare yet, so recheck the MX, SPF, and DKIM records the dashboard added.
- Reply from Gmail to confirm the From address behaves as expected, and watch for SPF failures if you spoof the domain rather than use a send-as with proper authentication.
- Re-run a public MX lookup against the domain from a network outside your own to rule out resolver caching.
If mail still lands nowhere, look at the drop action on rules and any Worker email processing routes that intercept before forwarding. Silent failures almost always trace back to an unverified destination or a stale MX record.
Before you touch the nameserver fields at your registrar, export the zone from your current DNS host and keep that file where you can reach it after the switch. Then work through the list in order: MX records with their priorities, SPF as a single TXT record at the apex, DKIM at every selector your mail actually signs with, DMARC at _dmarc. Confirm each one resolves from a public resolver with a query like dig MX yourdomain.com +short and dig TXT yourdomain.com +short while the old nameservers are still live, so you have a known-good baseline to compare against. Only after those answers match what you imported into Cloudflare should the delegation change go in.
Once the switch is done, treat the first 48 hours as an active watch rather than a wait. Send a test message from an outside account to a real mailbox on the domain, check that it lands in Gmail and not in spam, and read the headers to see which server handled it. If you are running Cloudflare Email Routing, open the dashboard and confirm every destination address shows as verified, the catch-all rule points where you expect, and no rule is silently hitting a drop action. Watch for the caps as well: 200 routing rules per domain, one destination per rule, and a 25 MiB ceiling on message size, since oversized mail is rejected rather than queued. Keep the old DNS export for at least a month. If a DKIM selector or a secondary MX turns out to be missing, you will have the exact record to paste back in, and a five-minute fix instead of a day of bounced invoices.