Copying Mail using Imapsync

Mail can be copied between IMAP servers using a graphical client such as Outlook or Thunderbird. However, these tend to be quite unreliable, often resulting in duplicates or missing messages.

An alternative is to use the imapsync script. For example, the following command copies all your mail from Fred’s INBOX folder at example.com to the Old-Mail folder at example.net:

imapsync --host1 mail.example.com --user1 fred --ssl1 --password1 secret1 \
         --host2 mail.example.net --user2 fred --ssl2 --password2 secret2 \
         --folder INBOX --prefix1 INBOX --prefix2 Old-Mail --dry

The –dry option prevents imapsync actually making any changes. Once you are sure you have all the options right, you can remove it to perform the sync.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.