Last Updated: February 25, 2016
·
485
· jpkrohling

Synchronizing IMAP mailboxes

This tip can be found pretty much everywhere on the interwebs, but when synchronizing twice between Google Mail and my own IMAP server, I've got the same emails over and over again. So, I just had to add the "--useheader" option, with the full command for the imapsync being:

imapsync --host1 imap.gmail.com --user1 <redacted>@gmail.com --password1 <your-password> --ssl1 --host2 <your-new-imap-server> --user2 <your-username> --password2 <your-password> --ssl2 --useheader Message-ID

Extra hint: you can just boot a Fedora 19 AMI from Amazon EC2 and run this command, specially if your new IMAP server is on EC2 itself (and you don't want to overload your mail server). The imapsync package is available in the default yum repositories.