I was installing horde on a new server today and had to migrate my imap folders from zimbra to postfix. Both servers run under ubuntu 12.04 LTS. I was trying some different tools, however the only working solution i found was to use imapsync: https://github.com/patkar/imapsync. To get it running on ubuntu you have to install the following packages:

apt-get install libterm-readkey-perl libmail-imapclient-perl and additionally from cpan:

perl -MCPAN -e shell

install Date::Manip

Then you can start with something like:

./imapsync –host1 host.de –user1 user@user.de –password1 pw1 –host2 –user2 user2@host2.de –password2 pw2 –noauthmd5 –ssl1

You have to use noauthmd5 and ssl1 for zimbra to be able to connect to the imap server, without these options it did not work for me.