Monday, December 12, 2011

Migrate inbox and sent items from old mailserver to google apps using imapsync

In my case i’m migrating from a Kerio Mailserver that is presenting all the folders as a subfolder of inbox, hence the

--sep1 . --prefix1 inbox

Always start the commands with the “–dry” option to do a dry-run (test-run) first!

To migrate the inbox and all subfolders:

imapsync --syncinternaldates --useheader 'Message-Id' --buffersize 8192000 --nosyncacls --host1 oldhost.domain.com --user1 thisisme@domain.com --passfile1 passfile1.txt --ssl1 --host2 imap.gmail.com --user2 thisisme@domain.com --passfile2 passfile2.txt --ssl2 --authmech2 LOGIN --sep1 . --sep2 . --prefix1 inbox --folderrec INBOX

Sent items need a little bit of translation. “Sent Items” will be translated to “[Gmail]\Verzonden berichten” (Dutch language).

imapsync --syncinternaldates --useheader 'Message-Id' --buffersize 8192000 --nosyncacls --host1 oldhost.domain.com --user1 thisisme@domain.com --passfile1 passfile1.txt --ssl1 --host2 imap.gmail.com --user2 thisisme@domain.com --passfile2 passfile2.txt --ssl2 --authmech2 LOGIN --sep1 . --prefix1 inbox --folder "Sent Items" --regextrans2 's/Sent Items/\[Gmail\]\/Verzonden berichten/'