How to sync IMAP email accounts
From an external mail server
A tool called "IMAP Sync" is installed on all the servers that will syncronize a mailbox between two servers. Before running this command, ensure that both the source and destination mailboxes exist and are accessible.
Run this command on the server that contains the new mailbox:
/usr/bin/imapsync --host1=host1.com --user1=sourceuser@host1.com --port1=993 --ssl1 --password1='XXX' --host2=127.0.0.1 --user2=destuser@host2.com --port2=993 --ssl2 --password2='XXX' --authmech1 LOGIN --authmech2 LOGIN
Between Mediashaker servers
- Log into Plesk on the source server
- Using Power Tools / Password Recovery, export all the usernames & password for the domain. They can be exported all at once as a list with one account per line and copied into the clipboard or notepad.
- Log into Plesk on the destination server.
- If necessary, create the destination domain.
- Open Power Tools / Email Address Creator, then copy/paste the data exported from the source server. This will create all the addresses on the destination server.
- SSH into the source server and run the following commands:
sudo -Es
cd /var/qmail/mailnames/
tar cvzf mydomain.com.tar.gz mydomain.com/
Note: Replace mydomain.com with the source domain name.
scp mydomain.com.tar.gz mmcluckie@10.138.192.225:/var/qmail/mailnames/
Note: To get the internal IP for a server just swith the 216. with 10. Note 2: If SCP does not work, download the file and upload it using Plesk. You may need to move it to the httpdocs folder of a site to access it.
- Once you have transferred the TAR file, SSH into the destination server and run the following commands:
cd /var/qmail/mailnames/
tar zxvf mydomain.com.tar.gz
chown -R popuser:popuser mydomain.com
Between domains on the same Mediashaker server
- Log into Plesk on the appropriate server
- Using Power Tools / Password Recovery, export all the usernames & password for the source domain. They can be exported all at once as a list with one account per line and copied into the clipboard or notepad.
- If necessary, create the destination domain.
- Open Power Tools / Email Address Creator, then copy/paste the data exported from the source server. Change the source domain to the destination domain in each address. This will create all the addresses on the destination domain.
- SSH into the appropriate server and run the following commands:
cd /var/qmail/mailnames/
cp -R sourcedomain/* destdomain/