in Mail

Transfer mailboxes between IMAP servers with imapsync

imapsync is a tool for facilitating incremental recursive IMAP transfers from one mailbox to another. It is useful for mailbox migration, and reduces the amount of data transferred by only copying messages that are not present on both servers. Read, unread, and deleted flags are preserved, and the process can be stopped and resumed. The original messages can optionally be deleted after a successful transfer.

1. Install imapsync

apt-get install imapsync

2. Sync the mailboxes

imapsync --host1 {host1} --user1 {user1} --password1 {password1} --host2 {host2} --user2 {user2} --password2 {password2} --subscribe

{host1}: The source mail server’s host or ip address
{user1}: User name on the source mail server
{password1}: Password on the source mail server
{host2}: The destination mail server’s host or ip address
{user2}: User name on the destination mail server
{password2}: Password on the destination mail server

When moving between different server software you may need to add or remove prefixes. For example when moving from dovecot to courier you need to add this parameter to remove the INBOX. prefix from the folder names: –prefix1 INBOX.

Write a Comment

Comment