Syncing or migrating IMAP e-mail accounts

There’s a free open source tool called imapsync that let’s you copy mail from one IMAP server to another. I’ve used this tool a lot when migrating e-mailaccounts to another server. Aside from copying e-mails from one server to another you can also keep them in sync. Check out the manpage for imapsync to see what’s possible, there are a lot of flags and parameters.

Here’s an example of syncing an e-mail account from one server to another.

$ docker run --rm -it gilleslamiral/imapsync imapsync \
    --syncinternaldates --noreleasecheck --no-modulesversion \
    --host1 server1.com \
    --tls1 \
    --user1 email@example.com \
    --password1 abcdef \
    --host2 server2.com \
    --tls2 \
    --delete2 \
    --user2 email@example.com \
    --password2 abcdef

Take note of the --delete2 flag which deletes e-mails on server2.com that aren’t on server1.com, thus keeping them in sync.

Scroll to Top