Our purpose is to move the mailbox sales@example.com (username: sales@example.com , password: secret ) on Server1.example.com to the sales@example.com mailbox on server2.example.com ( The username and password are the same as on server1.example.com ).
In addition, Ubuntu users should note that the following command must be run as root , so either add the sudo string after each command line or become root with the command:
sudosu
Before we get started, let's check both mailboxes to see what's in it (you can do this by any email client service like Outlook, Thunderbird or web mail like SquirrelMail we use below.) here).
server1.example.com:
server2.example.com:
After doing the following, the three messages in server1.example.com will appear in server2.example.com .
It is not important to install IMAPcopy on server1.example.com or server2.example.com , you can even install it on a 3rd machine without any trouble.
However, installing Java is necessary with IMAPcopy, so we will install the openjdk-6-jre package. In addition, make sure that the unzip is installed in order to extract the IMAPcopy package.
apt-get installopenjdk-6-jre unzip
Next download and install IMAPcopy in the path / usr / local / imapcopy / as below:
cd / usr / local /
mkdir imapcopy
cd imapcopy
wget http://imapcopy.googlecode.com/files/imapCopy0.3.1.zip
unzip imapCopy0.3.1.zip
Execute the script /usr/local/imapcopy/imapCopy.sh :
chmod + x /usr/local/imapcopy/imapCopy.sh
After successful installation, you start using IMAPcopy as follows:
/usr/local/imapcopy/imapCopy.sh protocol: // user [: password] @server [: port] protocol: // user [: password] @server [: port]
This protocol can use IMAP or IMAPS. If the username is the email address to note, replace @ with % 40 . Finally the command line to copy email messages from sales@example.com on erver1.example.com to sales@example.com on server2.example.com will be:
/usr/local/imapcopy/imapCopy.sh imap: //sales%40example.com: secret@server1.example.com imap: //sales%40example.com: secret@server2.example.com
And here is an example of output:
Now on the destination server ( server2.example.com ) will see the email from server1.example.com :