Page 1 of 1

How to sync/migrate emails using IMAPSync

Posted: Thu Nov 10, 2022 6:42 pm
by isscbta
Installation

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

### COPY-PASTE THIS AS ONE BLOCK ###
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
Now let's install our helpers scripts:

Code: Select all

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/create-mail-sync.sh https://c.myvestacp.com/tools/imapsync/import-from-file.sh
chmod u+x /root/imapsync/work/import-from-file.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, see next post.

Re: How to sync/migrate emails using IMAPSync

Posted: Fri Jan 19, 2024 4:10 pm
by myVesta
IMAP syncing

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

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

1. Go to the folder where we run commands.

Code: Select all

cd /root/imapsync/work

2. Let's create sync scripts for every email address that we are going to sync:

Code: Select all

./create-mail-sync.sh 'old.server.hostname' '[email protected]' 'password_on_old_server' 'password_on_your_myvesta_server'
Repeat this command as many times as needed based on the number of email addresses we are syncing.


3. Once you finish step two, let's run all those scripts and start syncing.

Code: Select all

cd /root/imapsync/work

./run-all.sh
You can run this script as many times as you want (without doing the first two steps) to resync email accounts.


4. When you finish syncing, and you don't need to resync those accounts anymore, run:

Code: Select all

rm -rf /root/imapsync/work/accounts/
This step is used to clear the accounts folder so that they will not be resynced again next time.


Additional explanation from the script creator can be found here: https://imapsync.lamiral.info/doc/TUTORIAL_Unix.html

That's all, Folks!