Migrate mail from one server to another with imapsync

Rob —  October 11, 2013 — 2 Comments

Have you been in the situation where you needed to move everyone’s mail from one provider to another?  It’s a pain to do using the mail client one at a time, but with this guide, you’ll be able to create a csv with everyone’s info and run one command to fire it all off.  All you need is a Linux machine to do it.

First, you’ll need to install the epel repo (skip if you already have it):

CentOS 5 (as root):

CentOS 6 (as root):

Now, use yum to install imapsync. It will automagically install all of the deps.

Now that it’s installed, let’s print out the help file and take a look at all of the usefulness of imapsync:

Now let’s get to business and start a sync. Let’s just do one user first before we jump into doing multiple at once.

Our info for this task:
Old: server=old.mailserver.com, user=test@domain.com, pass=mypasswd
New: server=new.mailserver.com, user=test@domain.com, pass=mypasswd

Here’s the command:

Let’s migrate multiple people at once now!

Create a file full of info called ‘file.txt’. An example is here

Now, paste this into sync_loop_unix.sh

(Make sure to change the hosts in the sync_loop_unix.sh file)

Make it executable:

Now run it!

You can add as many accounts as you want in the csv file.

Read more about imapsync on their official page: http://imapsync.lamiral.info/

Related posts from Linux Brigade!

2 responses to Migrate mail from one server to another with imapsync

  1. thanks for you tutorial!

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url=""> 

*