Business Email

How to Migrate Email Between cPanel Servers Without Data Loss

A step-by-step guide to moving all your mailboxes from one cPanel server to another while keeping every message, folder, and setting intact.

Top view of a workspace featuring hands using a laptop and smartphone on a wooden desk.

To migrate email between cPanel servers without losing messages, you have three main paths: the cPanel Transfer/Migration Tool (simplest when you have root access on both sides), imapsync (most reliable for large mailboxes), or manual IMAP sync with a desktop client (the no-root option). This guide covers all three.

Why Email Migrations Fail (and How to Avoid It)

Switching DNS too early is the most common mistake: you point the MX records to the new server before the mailboxes are fully copied, new messages arrive at the destination while the entire history is still stuck on the source. Emails don't "move themselves" when you change the MX.

The correct order is always:

  1. Create all accounts on the destination server.
  2. Copy all existing messages.
  3. Run a final sync right before the cutover.
  4. Update the MX records.
  5. Wait for propagation and verify.

Following this order ensures no message ends up in limbo.

If you have administrator access (WHM/root) on the destination server, cPanel's Transfer Tool is the fastest option. It copies email accounts, passwords, and messages in a single automated process.

Basic Steps

  1. Log into WHM → Transfers → Transfer Tool on the destination server.
  2. Enter the IP or hostname of the source server, the root user (or a reseller with sufficient permissions), and the SSH port (default 22).
  3. Select the hosting accounts you want to migrate.
  4. Choose which modules to copy: under "Mail," make sure Mail Configuration, Mail Filters, and Mailboxes are all checked.
  5. Start the transfer and wait for the success/error report.

This method preserves email account passwords, filters, and IMAP folders. The downside: it requires SSH/root access to the source server — something your previous provider may not grant.

Method 2: imapsync (Most Robust for Large Mailboxes)

imapsync copies messages mailbox by mailbox over the IMAP protocol. It doesn't need root access — only the IMAP credentials for each account on both servers. It's resumable (if interrupted, it picks up where it left off) and verifies each message after copying.

Quick Installation

On a Linux server with SSH access (can be the destination server or any intermediate machine):

sudo dnf install imapsync   # CentOS/RHEL/AlmaLinux
# or
sudo apt install imapsync   # Debian/Ubuntu

Basic Migration Command

imapsync \
  --host1 mail.sourceserver.com \
  --user1 [email protected] \
  --password1 "source_password" \
  --host2 mail.destserver.com \
  --user2 [email protected] \
  --password2 "dest_password" \
  --ssl1 --ssl2 \
  --delete2duplicates

The --delete2duplicates flag prevents duplicates if you run imapsync multiple times — which is standard practice. Run it once, let users keep working, then do a final pass right before switching the MX.

Bulk Migration with a Loop Script

If you have 20 accounts, don't do them one at a time. Create a CSV file with credentials and a bash script that iterates over it:

# accounts.csv
[email protected],source_pass,dest_pass
[email protected],source_pass2,dest_pass2

while IFS=',' read -r user pass1 pass2; do
  imapsync \
    --host1 mail.source.com --user1 "$user" --password1 "$pass1" --ssl1 \
    --host2 mail.dest.com --user2 "$user" --password2 "$pass2" --ssl2 \
    --delete2duplicates
done 

Store the CSV only in a secure location and delete it once the migration is complete — never leave plaintext passwords sitting on the server.

Method 3: Manual IMAP Sync with a Desktop Client

If you have no SSH or root access, you can copy messages using a mail client like Thunderbird configured with both accounts. It's slower but requires no server-side tools.

  1. Add the source server account in Thunderbird (IMAP).
  2. Add the destination server account in Thunderbird (IMAP).
  3. Select all messages in a folder from the source (Ctrl+A) and drag or copy them to the same folder in the destination.
  4. Repeat for every folder (Sent, Archive, custom folders).

The downside: for large mailboxes (thousands of messages) this can take hours and depends on your local internet speed. For high volumes, imapsync is clearly the better choice.

If you'd rather have a team handle the migration for you, elenlace.com provides technical support for hosting and business email migrations with zero data loss.

The Critical Step: MX Cutover and Verification

When to Change the MX Records

Change the MX records only after the final imapsync run (or the final manual copy) has completed. The ideal moment is off-peak hours — weeknight or weekend.

Lower the TTL Before the Cutover

At least 24–48 hours before the cutover, lower the TTL on your MX records to 300 seconds (5 minutes). That way, when you change the MX, propagation happens in minutes instead of hours. Restore the TTL to a normal value (3600 or 14400) after the cutover.

Post-Migration Verification

  • Send a test message to each departmental account from an external address (Gmail, Outlook).
  • Confirm the message arrives at the new server, not the old one.
  • Verify you can reply and that outgoing mail is delivered correctly.
  • Check your SPF, DKIM, and DMARC records — they should now reference the new server.

Keep the source server running with mailboxes intact for at least 7 days after the cutover. If any message was missed in the copy, you can still recover it.

Method Comparison Table

Method Root access required Speed Resumable Best for
Transfer Tool (cPanel/WHM) Yes (both servers) High Partially Full hosting migrations
imapsync No High Yes Email-only, any scale
Manual IMAP (Thunderbird) No Low No Few accounts, small volume

For more guides on managing business email, visit our business email articles.

Key Takeaways

  • Never change the MX before finishing the message copy — it's the number-one cause of email loss in migrations.
  • imapsync is the most reliable tool for migrating mailboxes without root access; it's resumable and deduplicates automatically.
  • Lower the TTL on your MX records 24–48 hours before the cutover to speed up propagation.
  • Run a final sync pass right before switching the MX to capture any messages that arrived during the migration window.
  • Keep the source server active for at least 7 days after the cutover as a safety net.

Have a migration coming up and can't afford to lose a single email? Contact us at elenlace.com — we'll guide you through every step so the server switch is completely transparent to your clients and team.

FAQ

How long does MX propagation take?

With a high TTL (86400 seconds = 24 hours), global propagation can take up to 48 hours. If you lower the TTL to 300 seconds before the cutover, propagation happens in minutes. Always lower the TTL well in advance.

Does imapsync copy the Sent folder too?

Yes. imapsync copies all IMAP folders, including Sent, Trash, Drafts, and any custom folders you've created. The --delete2duplicates flag ensures no messages are duplicated if you run the process more than once.

What happens to messages that arrive during the migration?

If the MX still points to the source server, new messages land there. That's why you should run a final imapsync pass right before switching the MX — it captures any last-minute messages that arrived since the first sync run.

Are email account passwords preserved during migration?

With the WHM Transfer Tool, yes — passwords are copied in their encrypted form. With imapsync, no — you create the accounts on the destination server yourself with new passwords. In that case, notify users so they can update their mail client settings.

Further reading

Other providers and guides worth comparing:

← All