Updated: 28 September 2026 · Applies to: imapsync 2.x

imapsync copies all email folders and messages from one mailbox to another over IMAP, for example when moving to Ucartz email hosting. It can run again safely: messages already copied are skipped.

Install

dnf install epel-release && dnf install imapsync      # AlmaLinux / Rocky (EPEL)
docker run --rm gilleslamiral/imapsync imapsync --version  # any system with Docker

On Ubuntu/Debian, the Docker image is the simplest option; imapsync is not in the Ubuntu 24.04 archive.

Copy a mailbox

imapsync --host1 mail.oldhost.com --user1 you@example.com --password1 'OldPass' \
         --host2 mail.example.com  --user2 you@example.com --password2 'NewPass'

Current imapsync versions use SSL/TLS automatically when the server supports it. Add --dry first to see what would be copied without copying.

Tips

  • Create the mailbox on the new server first (in cPanel: Email › Email Accounts).
  • Run imapsync once before you change the MX records, and again right after, to copy messages that arrived in between.
  • For many mailboxes, loop over a file with one line per mailbox.
  • Avoid passwords on the command line on shared machines: use --passfile1 and --passfile2.

Tip: Ucartz can migrate email for you as part of a website migration; ask our support team.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)