How to Migrate Email Accounts to a New Mail Server

Moving email accounts between mail servers — whether switching self-hosted setups or migrating to/from a hosted provider — requires care to avoid losing mail or causing extended downtime.

Planning Before You Begin

  • Inventory all mailboxes and their approximate size to migrate
  • Confirm the new server is fully set up and tested before migrating real accounts
  • Plan for DNS cutover timing (see Understanding DNS Propagation and TTL)

Step 1 — Set Up the New Mail Server Completely First

See How to Set Up a Complete Mail Server (Postfix + Dovecot + SPF/DKIM/DMARC) — ensure the new server is fully functional and tested with a test account before migrating real production mailboxes.

Step 2 — Lower DNS TTL in Advance

See Understanding DNS Propagation and TTL — lower your MX record's TTL several days before the planned migration, ensuring faster propagation when you actually make the cutover.

Step 3 — Migrate Mailbox Contents Using IMAP Sync

sudo apt install imapsync -y
imapsync --host1 old-mail-server.com --user1 [email protected] --password1 'oldpass' \
         --host2 new-mail-server.com --user2 [email protected] --password2 'newpass'

imapsync is the standard tool for this — it copies mail directly between IMAP servers, preserving folder structure and read/unread status.

Step 4 — Run a Test Sync First

imapsync --host1 ... --dry

Always test with --dry first to preview what would be synced without actually making changes, catching configuration issues before a real migration run.

Step 5 — Perform the Initial Full Sync

Run the actual sync for each account well before the planned cutover, while the old server is still the live, actively-receiving server.

Step 6 — Perform a Final Delta Sync at Cutover

imapsync --host1 ... --host2 ...

Running imapsync again close to actual cutover only transfers new mail received since the initial sync, minimizing the amount of mail that might arrive during the transition gap.

Step 7 — Update MX Records

Point your domain's MX records to the new mail server — incoming mail begins routing to the new server as DNS propagates.

Step 8 — Monitor Both Servers During the Transition Window

Some mail may still arrive at the old server during DNS propagation — keep it running and periodically re-sync any newly arrived mail until you're confident propagation is complete and no more mail is arriving at the old location.

Step 9 — Update Client Configurations

Notify users to update their mail client settings (server hostname) if it's changing, or configure automatic redirection/instructions if the hostname itself isn't changing but the underlying server is.

Step 10 — Decommission the Old Server (After Confidence Period)

Don't rush this — keep the old server available for a reasonable period after cutover, confirming no mail is still arriving there and all users have successfully transitioned.

Common Errors

Mail lost during migration — always verify with a dry run first, and never decommission the old server until you're fully confident the migration and cutover are complete and stable.

Continue Reading

Browse more articles in Email Hosting & Deliverability.

  • migrate email accounts, imapsync tutorial, mail server migration, email migration mx records
  • 0 Los Usuarios han Encontrado Esto Útil
¿Fue útil la respuesta?

Artículos Relacionados

How to Set Up a VPS for Email Marketing (Complete Guide)

Running your own email marketing infrastructure on a VPS gives you full control over...

How to Configure SPF, DKIM, and DMARC (Complete Guide)

SPF, DKIM, and DMARC are the three DNS-based email authentication standards that Gmail, Outlook,...

How to Set Up Reverse DNS (PTR/rDNS) for Email Deliverability

Reverse DNS (PTR record) maps your server's IP address back to a hostname — the opposite of...

IP Warm-Up: A Safe 30-Day Schedule for New Sending IPs

Mailbox providers like Gmail and Outlook monitor sending behavior closely and treat sudden...

Best Email Marketing Software for a VPS (MailWizz, Mautic, Listmonk & More)

Choosing the right self-hosted email marketing platform affects deliverability, ease of...