1) instalar modulos perl:
perl -e shell -MCPAN
install Mail::IMAPClient
install Digest::MD5
install Term::ReadKey
install IO::Socket::SSL
install File::Spec
install Digest::HMAC_MD5
install Authen::NTLM2) instalar imapsync
wget https://fedorahosted.org/released/imapsync/imapsync-1.456.tgz
tar xzpvf imapsync-1.456.tgz
cd imapsync-1.456
make install3) o comando
imapsync --host1 mail.servidor1.com --user1 logindousuario --password1 senhadousuario
--host2 mail.servidor2.com --user2 logindousuario2 --password2 senhaxxxObs. Se estiver importando/exportando do gmail precisa habilitar opção para clientes inseguros:
https://www.google.com/settings/security/lesssecureapps?pli=1