How to sync/migrate emails using IMAPSync

Post Reply
User avatar
isscbta
Team Member
Posts: 119
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 12 times
Been thanked: 3 times

In case when you need to sync emails from another server to your myVesta hosting panel, this script could be very useful.

Firstly, we will install this script, because it's not installed by default during myVesta installation. Here is the official GitHub link: https://github.com/imapsync/imapsync/bl ... Debian.txt

In your SSH, as root, run:

Code: Select all

apt update

apt install -y            \
  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        \
  make                     \
  time                     \
  cpanminus

cd /root

git clone https://github.com/imapsync/imapsync.git

cd imapsync

chmod +x imapsync

./imapsync --testslive

mkdir work
mkdir work/accounts

wget -nv -O /root/imapsync/work/create-mail-sync.sh https://c.myvestacp.com/tools/imapsync/create-mail-sync.sh
chmod u+x /root/imapsync/work/create-mail-sync.sh

wget -nv -O /root/imapsync/work/run-all.sh https://c.myvestacp.com/tools/imapsync/run-all.sh
chmod u+x /root/imapsync/work/run-all.sh
When we finish installation, we can proceed with further steps.

Before we begin with sync, those are important details that you have to know to be able to conduct the sync process:
1. You have to know the username, password, and the hostname of the email address on the old server
2. You have to create email addresses, which you are going to sync, on your myVesta hosting panel and remember the password

Now, when we know this, let's start with sync:

1. In your SSH, as root, run:

Code: Select all

rm -rf /root/imapsync/work/accounts/
You don't have to run this if you are doing sync for the first time. This step is used to clear /accounts folder if we previously did sync for another client.

2. Now go to the folder where we run commands.

Code: Select all

cd /root/imapsync/work
Let's create sync scripts for every email address which we are going to sync:

Code: Select all

./create-mail-sync.sh 'old.server.hostname' 'e[email protected]' 'old_password' 'my_vesta_email_password'
Repeat this command as many times as you need, based on number of email addresses which we are syncing

3. Once when you are done with step two, let's run all of those scripts and start syncing

Code: Select all

./run-all.sh
Additional explanation from the script creator could be found here:
https://imapsync.lamiral.info/doc/TUTORIAL_Unix.html

That's all Folks!

Tags:
Post Reply