Skip to content

Email

Migrating IMAP with imapsync

Copy folders and flags server-side before MX changes, then run a short tail pass after cutover.

Updated Aug 29, 20263 min read20 reads
Migrating IMAP with imapsync
Copy IMAP mail with imapsync before you change MX

imapsync is a server-side tool that copies folders, message flags, and mail from an old IMAP account to a new one. You run it while MX still points at the old host, then run it once more after the cutover so the last messages catch up. That order keeps you from losing a week of mail during the move.

Why the order matters

If you flip MX first and copy later, new mail lands on the new server while the bulk of the archive is still on the old one. People then see gaps, and you spend the next day chasing what arrived where. A full pass with MX still on the old side, followed by a short tail pass after the flip, keeps both sides in step. Users who keep downloading with POP or leave old clients open during the copy often create duplicates, so freeze those clients if you can.

LogicWeb can help with mail moves as part of a cPanel pull. If mail stays at Google, you do not need imapsync. Leave MX at Google and use a mailbox you will not check for day-to-day work.

Steps that avoid losing mail

  1. Create the mailboxes on the new side with the same local parts, and prove one login in Roundcube.
  2. Run imapsync from the old IMAP host to the new mailboxes while MX still points at the old host.
  3. Lower the TTL on your MX records if you still have time before the cutover.
  4. Flip MX to the new host, then run imapsync again for the tail that arrived on the old side during the first copy.
  5. Point clients at mail on your domain over IMAP, not POP.

When MX already points here

If MX already points at LogicWeb and people are missing folders, do not flip MX back. Run imapsync from the old host into the new mailboxes now. Use a dry run only if you have not started a real copy yet. Once mail is already flowing here, you want a live pass that carries flags, then a second pass for anything that still landed on the old side.

If the first pass already ran after MX flipped, do the tail pass anyway. Open Roundcube, not the phone, to confirm folder counts. Phones can subscribe once the server copy looks complete.

What duplicates usually mean

A user who left Thunderbird on POP with “leave a copy on the server” during the sync will download mail while imapsync also copies it, so INBOX looks doubled. Freeze the old clients or move them to IMAP after the cut. Seen and Flagged states come across when you let imapsync send flags. Folder names with odd punctuation sometimes need a second look in Roundcube after the copy finishes.

Share

Send this article

Need someone else to do this? Send them the link — the commands are in the article.

Tagged

Was this article helpful?

Be the first to rate this article.