imapsync tool is used to migrate IMAP accounts or to backup IMAP accounts. It allows recursive and incremental IMAP transfer from one mailbox to another. This guide explains how you can migrate mailboxes between IMAP servers with imapsync.
aptitude install imapsync
To learn about its usage, take a look at
man imapsync or imapsync –help
imapsync –host1 mail.hostname.com –user1 email@example.com –password1 **** –host2 mail2.host.com –user2 firstname.lastname@example.org –password2 ****
host1: source hostname or IP address
user1: email account name
password: password of the email account
host2: Destination hostname or IP address
imapsync can’t migrate contact and calendars
imapsync is not suitable for maintaining a synchronization between two active imap accounts while the user is working on both sides
Sometime the email account password may not be accepted due to a special character in the password, for this, you have to use the backslash ( \ ) before the special character.