Migrating email between hosts (IMAP sync)

Moving email from one host to another is one of the most-feared parts of switching providers. Done badly: lost messages, broken filters, days of confusion. Done right with IMAP sync: every message preserved with its folder, flags, and date intact, with zero downtime. This article covers the practical workflow.

The conceptual model

IMAP keeps mail on the server. When you connect from any client, you see the server's state. To migrate email is to copy the source IMAP server's contents to the destination IMAP server, while preserving:

  • Folder hierarchy (Inbox, Sent, Drafts, custom folders)
  • Per-message flags (read/unread, flagged, replied-to)
  • Original message dates (so the inbox sorts correctly after migration)
  • Attachments (which are just part of the messages)

You don't want to use POP3, drag-and-drop in Outlook, or "Save as PST" — these lose flags or dates.

Method 1: imapsync (best for many accounts)

imapsync is a free Linux tool specifically designed for IMAP-to-IMAP migration. Run it on a Linux machine (a $5 cloud VPS, your laptop, or your new server if you have SSH).

Install

$ sudo apt install imapsync          # Debian/Ubuntu
$ sudo dnf install imapsync          # Rocky/Alma/RHEL

Migrate one account

$ imapsync 
  --host1 mail.oldhost.com --user1 you@yourdomain.com --password1 OLDPASS 
  --host2 mail.yourdomain.com --user2 you@yourdomain.com --password2 NEWPASS 
  --ssl1 --ssl2 
  --port1 993 --port2 993

Watch output. imapsync iterates through every folder and message, skipping any already-synced ones. A typical mailbox of 5,000 messages takes 5-15 minutes. Run again after the initial sync to catch any new mail that arrived during the first run.

Migrate many accounts via a CSV

Create accounts.csv with columns: oldserver,olduser,oldpass,newserver,newuser,newpass

$ while IFS=, read -r h1 u1 p1 h2 u2 p2; do
    imapsync --host1 "$h1" --user1 "$u1" --password1 "$p1" 
             --host2 "$h2" --user2 "$u2" --password2 "$p2" 
             --ssl1 --ssl2 --port1 993 --port2 993
  done < accounts.csv

This loops through every account in the file. Useful when migrating a whole company or many domains.

Method 2: cPanel-to-cPanel transfer (easiest)

If you're migrating from another cPanel host, our migration tool moves mail along with everything else — no separate IMAP sync needed. Open a ticket with your old host's cPanel credentials and we'll handle it.

Method 3: Use a desktop email client (small mailboxes only)

For one or two accounts under 1 GB, Thunderbird or Mac Mail can do this manually:

  1. Connect both accounts (old and new) to your client via IMAP.
  2. Wait for both to fully sync (this can take 30+ minutes on first connection).
  3. Select all messages in each old folder, right-click → Copy to → pick the equivalent folder on the new account.

This works but is slow, error-prone for large mailboxes, and depends on your local internet for the entire transfer (the client downloads from old, uploads to new). Imapsync running server-side is faster.

The downtime question

Without careful planning, migrations have a window where mail might land on the old server and be missed:

  1. Pre-migration: mail flows to old server. You sync once.
  2. DNS update: MX records change. Some senders' mail goes old, some goes new (DNS propagates over hours).
  3. Post-migration: all mail goes to new server. Some still arrived at old server during step 2.

The fix: run imapsync once before changing DNS, change DNS, wait 24-48 hours, then run imapsync again. The second run picks up anything that landed on the old server during DNS propagation.

Lower TTL before migration

Two days before migration, lower your MX record's TTL to 300 seconds (5 minutes) at your current DNS host. When you change DNS, propagation completes in minutes instead of hours, shrinking the dual-delivery window. Detail in our DNS records article.

Verify after migration

For each migrated account:

  • Send a test message from another account; verify delivery to the new server.
  • Spot-check folder counts — does Inbox have the expected number of messages?
  • Verify folder hierarchy is preserved (custom folders intact).
  • Verify a sample of messages have correct dates (sort by Date in your client, top should be recent).

Common pitfalls

  • Authentication failure on old server. Some hosts require you to enable IMAP explicitly or use an "app password." Check the source host's docs.
  • Folder name mismatches. Old host uses "Sent Items," new host uses "Sent." imapsync's --regextrans2 flag rewrites folder names during sync.
  • Quota exceeded on destination. The mailbox is bigger than the destination quota. Increase quota first, or archive old messages locally.
  • Resyncing the same accounts wastes time. imapsync skips already-synced messages by default, but the first comparison pass takes minutes for huge mailboxes. Be patient on re-runs.
  • email, IMAP, migration, imapsync
  • 0 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

Nameservers

The nameservers to use for our webhosting services are below: all1.dnsroundrobin.net...

Setting up Dynamic DNS in cPanel

cPanel includes a built-in Dynamic DNS feature that automatically keeps an A record pointed at a...

Setting up Cloudflare with cPanel: the right way

Cloudflare is a free CDN and DDoS-protection service that sits in front of your ipxcore cPanel...

Speeding up WordPress on cPanel hosting

A slow WordPress site costs you visitors, conversions, and search rankings — Google has...

How to migrate your website to ipxcore from another host

Migrating an existing website to ipxcore is a process we've helped thousands of customers...