I’ve been using mbsync for exactly this reason for years. It’s sort of finicky to set up, but it works really well for pulling and pushing IMAP mail around.
+1 for mbsync. Incredibly powerful, especially the ability to control how propagation happens (master -> slave, or vice versa).
Thank you for this! I’m moving IMAP hosts next month, and I was tearing my hair out trying to get ‘doveadm’ playing nicely. This is far more straightforward.
Well… maybe not so fast. My use-case is such that I want to pull from IMAP Server 1 and copy to IMAP Server 2. getmail seems to support only pulling from IMAP Server 1 and copying to a local folder. Troubleshooting why I couldn’t get that to work led me to the Python3-compatible getmail6 fork - https://getmail6.org/ - which has the same limitation, and to the older-but-works-for-my-use-case tool ‘imapsync’ - https://imapsync.lamiral.info
imapsync did what I needed it to do, with similarly-straightforward setup. So… even though getmail didn’t quite work for me, thanks for sending me down a pleasant 20-minute rabbit-hole which eventually led to me solving my problem instead of continuing to bash my head against doveadm’s way of doing things! :-)
Lots of email hosts have special features that don’t map perfectly to IMAP concepts, making migration seriously hard. I specifically remember the doveadm docs warning somewhere that sync isn’t reliable except between 2 dovecot servers for that reason. The docs on syncing with gmail illustrate some of these problems.
Thanks for the reply, and good luck for your migration!