Follow this easy method for transferring all e-mails, including folders, from a single IMAP account to another.
First, let’s git it with “git”:
# git clone https://github.com/imapsync/imapsync
Install dependencies for any Ubuntu flavor. I’m using 20.04:
# sudo apt-get install \
libauthen-ntlm-perl \
libclass-load-perl \
libcrypt-ssleay-perl \
libdata-uniqid-perl \
libdigest-hmac-perl \
libdist-checkconflicts-perl \
libencode-imaputf7-perl \
libfile-copy-recursive-perl \
libfile-tail-perl \
libio-compress-perl \
libio-socket-inet6-perl \
libio-socket-ssl-perl \
libio-tee-perl \
libmail-imapclient-perl \
libmodule-scandeps-perl \
libnet-dbus-perl \
libnet-ssleay-perl \
libpar-packer-perl \
libreadonly-perl \
libregexp-common-perl \
libsys-meminfo-perl \
libterm-readkey-perl \
libtest-fatal-perl \
libtest-mock-guard-perl \
libtest-mockobject-perl \
libtest-pod-perl \
libtest-requires-perl \
libtest-simple-perl \
libunicode-string-perl \
liburi-perl \
libtest-nowarnings-perl \
libtest-deep-perl \
libtest-warn-perl \
make \
time \
cpanminus
Install the following Perl modules:
# sudo cpanm Mail::IMAPClient
# sudo cpanm JSON::WebToken
Next change into the cloned directory and run imapsync with the following syntax:
# cd imapsync
# ./imapsync --host1 test1.lamiral.info --user1 test1 --password1 secret1 --host2 test2.lamiral.info --user2 test2 --password2 secret2