Home Server Linux Debiam IMAPsync Move Email Messages Between Servers via Console

Linux Debiam IMAPsync Move Email Messages Between Servers via Console

How to synchronize email folders and messages between servers, for example, between the previous and the current mail server. The example pertains to servers based on the Debian Linux system.

Mail Server
Mail Server

Below is the instruction for synchronizing email folders between servers, for example, between the previous and the current mail server. The example pertains to servers based on the Debian Linux system.

How to check your Debian release?

Type on a terminal:
cat /etc/debian_version

12.x => Bookworm
11.x => Bullseye
10.x => Buster
9.x => Stretch
8.x => Jessie
7.x => Wheezy

1. Install imapsync dependencies on a Debian system.

• Debian 12 Bookworm
deb http://deb.debian.org/debian bookworm main contrib

• Debian 11 Bullseye
deb http://deb.debian.org/debian bullseye main contrib

• Debian 10 Buster
deb http://deb.debian.org/debian buster main contrib

• Debian 9 Stretch
deb http://deb.debian.org/debian stretch main contrib

apt update && apt upgrade -y

apt 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 libproc-processtable-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 libnet-server-perl make time cpanminus -y

2. Download IMAPsync (to some catalog):
https://www.Mario.Chivale.com/download/IMAPsync.zip
chmod +x imapsync

3. Perform a test:
./imapsync –testslive

4. Install IMAPsync on the system:
cp imapsync /usr/bin/

5. Synchronize mail between servers:

imapsync \
--host1 MailServer1 --user1 User1 --password1 Password1 \
--host2 MailServer2 --user2 User2 --password2 Password2

or

imapsync --host1 MailServer1 --user1 User1  --password1 Password1  --host2 MailServer2  --user2 User2 --password2 Password2

Change MailServer1 and MailServer2 to your E-Mail servers, User1 and User2 to your username and Password1 and Password2 to your password!