HOW TO: Using IMAPSync to Transfer mail from server to server
There is an active feature request to have cPanel add a tool to help migrate IMAP Mailboxes from a non-cPanel server to a cPanel server. This is very important if you are trying to help a customer move to your cPanel hosting service, from a non-cPanel server. You can read (and vote on) the feature request at: Migrate IMAP mailbox to cPanel
Our company has been very successful in using a command-line tool called IMAPSync to accomplish this task. I was asked in the feature request thread to document how to install and use this tool, so here goes:
About the tool:
imapsync is a tool authored by French developer Gilles Lamiral.
It is not free, but is a reasonable "50 EUR for lifetime license.
Full "professional support" available for an extra "50 EUR.
Official website: Official imapsync migration tool ( release 1.727 ) -- a LOT of info here, so go and read it!
NOTE: You can keep running this script over and over. It will skip messages that already exist on the new server. So, you can copy once, then change MX/DNS, then run it again later, to catch any messages that came in after the first run.
Check to see if you have imapsync installed already:
Issue the command: imapsync -v
If you have it installed, it will report back the version number.
If you do not have it installed, of course it will just result in an error.
Install imapsync:
imapsync requires the epel repo. On my cPanel servers, I don't have the epel repo installed or enabled, so my instructions will show how to do that also. Your mileage may vary.
-
Excellent tutorial Scott. I'll try it soon. 0 -
Hello Scott, Thanks for taking the time to write up this tutorial! 0 -
Thanks, really great info here . I really really hope that cPanel will consider integrating this tool and an interface for it like in the mentioned feature request . It is really a must today ( 4 years after the request was made ) when IMAP is quasi-standard .. Some questions : Does the above process leave the original box intact ? In my scenario, I have a bad host / panel, about 8 years old, with not many mailboxes or mails ( 2-3 boxes, few hundreds mails ). I would like to use the following workflow : 1- Create a new account in cpanel 2 - move the mailboxes and mails 3 - Check the mails manually on the ( new ) WHM/ Cpanel account 3 - Only after that to transfer the DNS / Domain registration to new server. Would that be a viable workflow with this tool ? Does the tool works the same for sub.domains ? ( e.mail@sub.domain.com[/EMAIL] ) I assume yes (because it is imap ), but just to make sure - the SENT folder is also transfered ? 0 -
Hello @krembo99, You shouldn't encounter any issues with the workflow you described. The messages on the source server are not deleted unless you specify the "--delete" flag in the command. Email accounts associated with subdomains should work the same way as regular domain names. Thank you. 0 -
Will the instructions of this tutorial sync folders inside mailboxes? 0 -
Will the instructions of this tutorial sync folders inside mailboxes?
Yes. - Scott0
Please sign in to leave a comment.
Comments
7 comments