Moving email has one rule: mail must always have somewhere to land. Create the new mailboxes first, copy the old mail across, switch the MX recordsMX record The domain setting that tells the world where to deliver your email. More about MX record →, then copy again to catch anything that arrived during the change.
Create the mailboxes at the new provider, copy existing mail across with IMAP, switch the MX records, copy again to catch stragglers, then move each person’s devices. Mail keeps arriving throughout, so done in this order, nothing is lost.
What moves and what does not
| Item | Moves with IMAP copy | Do it separately |
|---|---|---|
| Emails in every folder | Yes | |
| Sent items and drafts | Yes | |
| Contacts | No | Export as vCard or CSV, import at the new provider |
| Calendars | No | Export as .ics, import |
| Filters and rules | No | Recreate by hand |
| Aliases and forwarders | No | Recreate at the new provider |
| Signatures | No | Recreate in each app |
| Auto-replies | No | Recreate |
Mailboxes downloaded with POP3 (rather than IMAP) usually have nothing left on the server to copy: the mail lives in the person’s mail app. Move it by adding the new account to that app over IMAP and dragging folders across.
Before you start
- List every mailbox, alias and forwarder on the old host.
- Get the IMAP server name and a password for each old mailbox.
- Create the same mailboxes, with passwords, at the new provider.
- Lower the TTLTTL How long other computers may remember a domain setting before checking again, in seconds. Short means changes show up faster. More about TTL → on your MX records to 300 seconds a day ahead.
1. Copy existing mail over IMAP
Many providers have a built-in migration tool that logs into the old server and copies everything. If yours does not, imapsync is the standard command-line tool:
imapsync \
--host1 mail.oldhost.example --user1 you@example.com --password1 'old-pass' \
--host2 mail.newhost.example --user2 you@example.com --password2 'new-pass'
It copies every folder and skips messages that already exist, so you can run it again safely.
2. Switch the MX records
Replace the old MX records with the new provider’s, and add their SPFSPF A list you publish saying which services are allowed to send email for your domain. Mail from anywhere else looks suspicious. More about SPF → include and DKIM record. See SPF, DKIM and DMARC. New mail starts arriving at the new provider as the change spreads.
MX records for common providers
| Provider | MX record |
|---|---|
| Google Workspace | 1 smtp.google.com. |
| Microsoft 365 | 0 example-com.mail.protection.outlook.com. (your exact value is in the admin centre) |
| cPanel hosting | Usually 0 example.com. or mail.example.com., set by the host |
Remove every old MX record, not just the first one. A leftover old record with a lower priority number keeps receiving some of your mail.
3. Copy again
Run the same imapsync command a day later, and again after three days, to pick up messages delivered to the old server by senders whose DNSDNS The internet’s phone book. It turns a name people can remember, like example.com, into the number address computers use to find the server. More about DNS → had not caught up.
Check mail is arriving at the new provider
dig example.com MX +short
Once it shows only the new provider, send test messages from an outside address, such as a personal Gmail, to each mailbox. Then check the old server’s mail log or webmail for any new arrivals; when none arrive for a day, the switch is complete.
4. Move people’s devices
Update every phone and mail app with the new server settings, or remove and re-add the account. This is often the slowest part; send everyone the new settings in advance.
Typical settings for mail apps
| Setting | Usual value |
|---|---|
| Incoming (IMAP) | Port 993, SSL/TLS |
| Outgoing (SMTP) | Port 465 (SSL/TLS) or 587 (STARTTLS) |
| Username | The full email address |
Most apps detect these automatically from the address alone, if the provider publishes autodiscover or autoconfig records. Check the provider’s setup page and add any autodiscover CNAMECNAME record A domain setting that says “this name is just another name for that one”. For example, www pointing at the main domain. More about CNAME record → or SRV records it lists.
Do not cancel the old email service until the final copy has run and every device has moved. Messages left only on the old server are lost when the account closes.
Related
Something out of date? Software changes. If a step no longer works, tell us and we will check it and update the page.
