That’s right, folks. After the grueling 72hr dovecot-to-gmail (Google Apps) migration ~1.5 years ago, it’s that time of the decade where we are going to do it in reverse!
In fairness to Google, their migration API back then was weak (or non-existent?). Mails have to be sent one by one via SMTP. Lucky for us, Gmail-to-IMAP isnt that painful, thanks to 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.
Usage is very simple:
./imapsync –host1 imap.gmail.com –port1 993 –user1 firstname.lastname@example.org –passfile1 /home/user/passwordfile –ssl1 \
–host2 mail.domain.com –port2 993 –user2 user –passfile2 /home/user/passwordfile –ssl2
It’s safer to use –passfile than –password so that your password does not show in ‘ps’, in case there are other users in the server. imapsync is written in perl and requires additional modules:
Your IMAP folders may not appear on your mail client. You may have to manually subscribe to your folders.