Home > Email > Email migration using imapsync

Email migration using imapsync

Email migration is tough job.   There are application that can do this but,  it will not include emails with attachments.

I found imapsync do the job for me.   How I did it?  Here’s how:

Install imapsync

# apt-get install imapsync

The syntax is:

# /usr/bin/imapsync \

—host1 imap.truc.org —user1 foo —passfile1 /etc/secret1 \

—host2 imap.trac.org —user2 bar —passfile2 /etc/secret2

This syntax will only migrate 1 email account from 1 domain to another. I created a script that will read the details from file and process the migration.

while read v1 v3 v4 v5 v6
do echo”$v1″ > gmail.account
echo “$v2” > gmail.passwd
echo “$v4” > domain.account
echo “$v5” > domain.passwd
echo “$v6” > domain.log.account

# to test the script you have to add —dry
# Dry run

imapsync —host1 imap.gmail.com —ssl1 –authmech1 LOGIN —user1 $v1 —password1 $v2 —host2 mail.domain.com —ssl2 —authmech2 LOGIN —user2 $v4 —passfile2 $5 —skipsize —allowsizemismatch —dry > /home/root/imapsync/logs/$v6
done < migrate.account

This script will read the email account detail from migrate.account up to the last record. Lists of email accounts that you want to migrate.

email@gmail.com gmailpassword email@domain.com domainpassword email_log

To run the script:

You have to set the permission of the script

# chmod 744 email.migration

Create a log folder

# mkdir logs

Run the script

# ./email.migration

And of you go.   Now, monitor the migration in log folder

Categories: Email Tags:
  1. Viktor Petersson
    July 9, 2010 at 4:16 pm

    Very straight-forward guide. Great idea to use shell-variables to use enter username and password. The only problem is that you are limited to your local bandwidth (assuming you’re not running it on a server in a data center).

    Next time, you might also want to look into Yippiemove (http://www.yippiemove.com). It’s not free, but it’s dead simple to use and is not limited to your local bandwidth.

    • July 20, 2010 at 7:43 pm

      In this time of crisis every dime is important. Besides, I run it in the data center that’s why our migration only took some time to complete.

  2. June 19, 2013 at 4:53 pm

    Wow, this article is fastidious, my sister is analyzing such things,
    so I am going to tell her.

  3. March 7, 2014 at 6:07 pm

    I have read so many articles on the topic of the blogger lovers however this piece
    of writing is truly a good piece of writing, keep it up.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: