Transferring email can be done many different ways and can be quite difficult without the right tools. The tool imapsync, included in the EPEL repository, allows for the easy transfer of emails from one server to another. All that is required is the hostname/IP of the source and destination server, along with the credentials to both email accounts.
This program uses IMAP to transfer all of the emails, folders, and statuses of each email with very little effort. This can be run on any server and can be done on a third party server, separate from any of the email servers. This tutorial is for servers running CentOS and no other requirements are needed.
This page is for transferring an email account from one IMAP account to the other using imapsync in the EPEL repository. All that is needed is the credentials for both servers and hostnames. If you wish to transfer the email, follow the steps below to get started.
-Install the EPEL repository by following the steps below
-Copy the download link for your particular release of Centos
-Perform the command and change the download link as necessary
-Run the command to install EPEL:
rpm –ivh epel-release*
-Retrieve the credentials and hostnames for both servers
-Edit/create the password file /root/password and insert the password of the source server’s email
-Edit/create the password file /root/password2 and insert the password of the destination server’s email
-Start forming the command by typing imapsync
-Insert the hostname or IP address after the –host1 of the source server (ex. imapsync –host1 hostname.or-ip.com)
-Insert the user after the –user1 option of the source server
-Insert the location of the sources server email password file after the –passfile1 option
-Insert the hostname or IP address after the –host2 of the destination server
-Insert the user after the –user2 option of the destination server
-Insert the location of the destination server email password file after the –passfile2 option
-Run the command
imapsync –host1 hostname.or-ip.com –user1 firstname.lastname@example.org –passfile1 /root/password –host2 hostname.or-ip.com –user2 email@example.com –passfile2 /root/password2
You can use imapsync –help to view the options of the command or specify particular ports/encryption/authentication.