Migrating mails via imapsync¶
Imapsync is a popular tool to migrate mails from one IMAP server to another.
The following command can be used to migrate data from the source server (credentials specified as --host1
, --user1
and --password1
) to the destination server (credentials specified as --host2
, --user2
and --password2
):
docker run --rm --network host gilleslamiral/imapsync imapsync --host1 source.server.com --user1 source-user --password1 'password' --host2 kopano.cloud --user2 user@example.com --password2 'password' --no-modulesversion --noreleasecheck --automap --useheader message-id --addheader --exclude Outbox --exclude Postausgang
The following parameters are important:
--automap
: This maps "special folders" to their counterparts on the destination server. This is required as there may be system folders that cannot be recreated through IMAP, like the Junk Mail folder for example.--useheader message-id
: This parameter is important when copying messages e.g. from Kopano as otherwise rerunning imapsync will lead to duplicate mails.--exclude Outbox
: The "Outbox" is a special folder that needs to be excluded from sync.
Important
The value of --exclude Outbox
needs to be adapted to the language of the source mailbox. To see a list of all folders in the source mailbox add --justfoldersizes
to the imap command to only generate a summery in imapsync, but not do any actual mail migration.