Change email provider without losing a single message
Moving your mailboxes to a new provider comes down to one DNS edit, and mail still goes astray around it. Resolvers keep serving your old MX records until their cached copy expires [2], so some mail keeps reaching the old provider. Delete the old MX before the new one exists, and senders try your domain’s own address instead [1].
The short answer
Set up the new provider first: mailboxes, its DKIM records and its include in your one SPF record. Lower the MX TTL well ahead. Replace the old MX records with the new ones in a single edit. Keep the old account open until mail stops arriving there, then remove the old provider’s SPF include and DKIM records.
What goes wrong during a switch
Three symptoms show up, each with its own cause.
New mail still lands in the old mailboxes. Each MX record carries a TTL, the time a resolver may cache it before asking again [2]. Until that time runs out, a sender’s resolver keeps the old answer and delivers to the old provider.
Mail bounces or arrives days late. If your domain has no MX records at all, RFC 5321 tells senders to treat the domain itself as an implicit MX with preference 0 [1]. If example.com points at a web host, senders try to deliver your mail there. A sender whose delivery fails keeps retrying, and RFC 5321 says the give-up time “generally needs to be at least 4-5 days” [1]. Resolvers can also cache the answer “no MX here” for the time set in your zone’s SOA record [3].
Mail you send starts failing SPF. Two SPF records on the same name produce permerror [4]. An include that points at a provider who no longer publishes SPF at that name also produces permerror [4].
To see the TTL your DNS host publishes, ask one of your domain’s name servers, which dig +short NS example.com lists. A public resolver shows only the seconds left in its own cache [2].
dig +noall +answer MX example.com @ns1.example.net
example.com. 3600 IN MX 1 smtp.google.com.
The second column is the TTL in seconds. Here, resolvers may keep this answer for up to an hour after you change it.
What changes and what stays
The example moves example.com from Google Workspace to Fastmail. The same order works for any pair of providers. Email provider DNS records lists the records each one asks for. If Cloudflare Email Routing receives your mail today, read turning off Cloudflare Email Routing first: disabling it deletes the MX, SPF and DKIM records it added [11].
| Record | Before | During the switch | After |
|---|---|---|---|
| MX | Fastmail, changed in one edit | Fastmail | |
| SPF | Google’s include | Both includes in one record | Fastmail’s include |
| DKIM | Google’s selector | Both selectors | Fastmail’s selectors |
| DMARC | Unchanged | Unchanged | Unchanged |
Your DMARC record stays as it is. Check that the new provider signs and sends in alignment with example.com. Relaxed alignment, the default, accepts any domain with the same organizational domain as your From address [6].
Switch in six steps
1. Set up the new provider before you touch MX
Add the domain at the new provider, create the mailboxes and aliases, and add its DKIM records. A receiver looks up a DKIM key at <selector>._domainkey.<domain>, taken from the signature’s s= tag [5], so each provider’s keys live at their own names. Google Workspace’s default selector is google [9]. Fastmail uses three CNAME records [10]:
fm1._domainkey.example.com. CNAME fm1.example.com.dkim.fmhosted.com.
fm2._domainkey.example.com. CNAME fm2.example.com.dkim.fmhosted.com.
fm3._domainkey.example.com. CNAME fm3.example.com.dkim.fmhosted.com.
These names do not collide with google._domainkey.example.com, so both providers can sign mail during the move.
2. Put both providers in your one SPF record
SPF lives in a single TXT record per name. A second record starting with v=spf1 turns the result into permerror [4]. Add the new provider’s include to the record you have.
Before:
example.com. TXT "v=spf1 include:_spf.google.com ~all"
During the switch:
example.com. TXT "v=spf1 include:_spf.google.com include:spf.messagingengine.com ~all"
Google documents include:_spf.google.com [8] and Fastmail documents include:spf.messagingengine.com [10]. Fastmail’s suggested record ends in ?all [10]. A merged record keeps one all at the end, so keep the one your domain already uses. More on merging: two SPF records on one domain.
3. Lower the MX TTL well ahead of the switch
A resolver that cached your MX record with the old TTL keeps it for that long [2]. Lower the TTL to 300 seconds at least one old TTL before the switch. With a TTL of 86400 seconds, that means a day ahead. Fastmail publishes the records it manages with a TTL of 1 hour [10].
4. Replace the MX records in one edit
Before:
example.com. 300 MX 1 smtp.google.com.
After:
example.com. 300 MX 10 in1-smtp.messagingengine.com.
example.com. 300 MX 20 in2-smtp.messagingengine.com.
Google’s single MX value is smtp.google.com with priority 1 [7]. Fastmail’s are in1-smtp.messagingengine.com with priority 10 and in2-smtp.messagingengine.com with priority 20 [10].
If your DNS panel saves one record at a time, add the new records first and delete the old one right after them. Senders try the lowest preference number first [1], so while both sets exist, mail still goes to Google’s 1. Nothing is lost in that window. Then delete every old MX record: Google’s own setup page warns that old MX records left in place can stop email from working correctly [7].
5. Keep the old account open
Senders whose resolvers cached the old MX keep delivering there until the TTL runs out [2], and Google says new MX records can take up to 72 hours to be recognized [7]. Keep the old mailboxes open until new mail stops arriving in them, then move what arrived there to the new provider.
6. Clean up SPF and DKIM
When nothing sends through the old provider any more, remove its include:
example.com. TXT "v=spf1 include:spf.messagingengine.com ~all"
Google’s SPF guide also asks you to remove senders you no longer use [8]. An old include keeps authorizing the old provider’s servers to send as example.com. If that provider stops publishing SPF at the included name, your record returns permerror [4]. Then remove or revoke the old DKIM selectors, in the order described in DKIM records still pointing at your old provider, and raise the MX TTL back to its usual value.
Mistakes to avoid
- Deleting the old MX before adding the new one. For that moment the domain has no MX, senders fall back to the implicit MX [1], and resolvers may cache the empty answer for the SOA’s negative TTL [3].
- Adding a second SPF record for the new provider. Two
v=spf1records on one name are a permerror for every message [4]. Merge them into one. - Removing the old include on switch day. Mail that apps or devices still send through the old provider’s SMTP server then stops passing SPF.
- Closing the old account the same day. Cached MX records still point there [2].
- Lowering the TTL at the last minute. The lower value only helps resolvers that fetch the record after you change it [2].
Check your MX records
The checker reads your MX records from your browser, names the provider they point to, and flags a missing or null MX.
Runs in your browser. Your domain is not sent to this site or stored.
Related guides
Turning off Cloudflare Email Routing deletes your MX, SPF and DKIM records
Disabling Cloudflare Email Routing deletes its MX, SPF and DKIM records. That includes the ones you edited. The safe order to leave it, and how to move onto it.
DKIM records still pointing at your old provider: what to keep and what to remove
Old DKIM keys keep validating mail signed for your domain. Find the selectors an old provider left, remove or revoke them safely, and fix dangling CNAMEs.
Two SPF records on one domain: why both stop working, and how to merge them
Two SPF records on one domain make SPF fail for both providers. Receivers return permerror. Find the duplicate and merge them into one valid TXT record.
