I ran imapsync on my mail server like this to move a couple of accounts away from my server:
imapsync –syncinternaldates –host1 localhost –user1 user –password1 secret –host2 imap.gmail.com –port2 993 –ssl2 –user2 [email protected] –password2 secret –authmech1 LOGIN –authmech2 LOGIN –split2 100
(WordPress is a bit too clever, so — above means two hyphens. Sorry.)
Parts of the output looks weird but everything seems to work anyway. For example:
Host imap.gmail.com says it has NO CAPABILITY for AUTHENTICATE LOGIN
Success login on [imap.gmail.com] with user [[email protected]] auth [LOGIN]