1. Installation.
https://imapsync.lamiral.info/INSTALL.d/INSTALL.Debian.txt
aptitude install libauthen-ntlm-perl libcgi-pm-perl libcrypt-openssl-rsa-perl libdata-uniqid-perl libencode-imaputf7-perl libfile-copy-recursive-perl libfile-tail-perl libio-socket-inet6-perl libio-socket-ssl-perl libio-tee-perl libhtml-parser-perl libjson-webtoken-perl libmail-imapclient-perl libparse-recdescent-perl libmodule-scandeps-perl libreadonly-perl libregexp-common-perl libsys-meminfo-perl libterm-readkey-perl libtest-mockobject-perl libtest-pod-perl libunicode-string-perl liburi-perl libwww-perl libtest-nowarnings-perl libtest-deep-perl libtest-warn-perl make cpanminus
cd /home/username/
wget -c https://imapsync.lamiral.info/dist2/imapsync-1.977.tgz
tar -xf imapsync-1.977.tgz
cd imapsync-1.977
2. Usage
https://imapsync.lamiral.info/#DOC_BASIC_UNIX
User login
./imapsync --host1 mail.host.pl --user1 user1@host.pl --password1 "sicret_pass" --host2 mail.host2.pl --user2 user1@host2.pl --password2 "sicret_pass2"
Master User login
./imapsync --host1 mail.host.pl --user1 "user1@host.pl*masteruser_login" --password1 "masteruser_pass" --host2 mail.host2.pl --user2 "user1@host2.pl*masteruser2_login" --password2 "masteruser_pass2"
3. Import credentials from CSV
vim sync_loop_unix.sh
echo Looping on account credentials found in file.txt
echo
{ while IFS=';' read h1 u1 p1 h2 u2 p2 fake
do
{ echo "$h1" | tr -d '\r' | egrep '^#|^ *$' ; } > /dev/null && continue # this skip commented lines in file.txt
echo "==== Starting imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ===="
./imapsync --notls1 --host1 "$h1" --user1 "$u1" --password1 "$p1" \
--host2 "$h2" --user2 "$u2" --password2 "$p2" \
"$@"
echo "==== Ended imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ===="
echo
done
} < file.txt
vim file.txt
mail.host.pl;user1@host.pl*masteruser_login;masteruser_pass;mail.host2.p;user1@host2.pl*masteruser2_login;masteruser_pass2 mail.host.pl;user2@host.pl*masteruser_login;masteruser_pass;mail.host2.p;user2@host2.pl*masteruser2_login;masteruser_pass2
chmod +x sync_loop_unix.sh
./sync_loop_unix.sh
https://imapsync.lamiral.info/examples/sync_loop_unix.sh