Topic: Migration from Kerio Mail Server

How can I migrate from Kerio Mail Server to iRedMail?

At least, how can I copy email store from KMS into iRedMail? Are there any right ways in order to do this as correctly as possible?


Re: Migration from Kerio Mail Server

I did that successfully with imapsync, worked like a charm.


Re: Migration from Kerio Mail Server

Thanks a lot! It's very usefull for any mailservers!


Re: Migration from Kerio Mail Server

Would you guys mind share as detail tutorial?



Re: Migration from Kerio Mail Server

With a pleasure, but a bit later, sorry...

6 (edited by billybons2006 2010-06-11 22:08:12)

Re: Migration from Kerio Mail Server

Ok, micro-howto:

1. We need to install 'imapsync'. I think, you can install it on any computer (source-mail-server, target-mail-server or your-workstation) - not on all, but on one of them. During setup you will facing with troubles with perl modules installing. But I can advise you setup Webmin and use it for installing perl modules - it can be useful at this time and for your future needings. But, IMHO.
2. You must prepare accounts on target server. I think it will be very useful to create accounts on target server with the same passowrds (like on old server). Thus you will reduce config troubles in the future steps. And, by the way, you reduce migration troubles with setting up email clients.
3. Examples 'how-to use imapsync' you can take from 'http://www.linux-france.org/prj/imapsync/README'. The mail idea is:

# imapsync --host1 server1 --user1 user1 --password1 password1 \
    --host2 server2 --user2 user2 --password2 password2

All options are clear!

You can prepare two files with passwords and command above become:

# imapsync --host1 server1 --user1 user1 --passfile1 /etc/secret1 \
    --host2 server2 --user2 user2 --passfile2 /etc/secret2


# imapsync --host1 server1 --user1 user1 --passfile1 /etc/secret \
    --host2 server2 --user2 user2 --passfile2 /etc/secret

, if you created accounts with the same passwords!
As you may see, imapsync can use external sources (like files). But you can build bash scripts for read file with account names, passwords etc. For small example you cat read this one: http://extmemory.blogspot.com/2009/10/imapsync.html

I want pay your attention to option '--noauthmd5':

# imapsync --noauthmd5 ...

You can use this option if your mail servers do not allow MD5-passwords.

I've tested only method with secret files (see above) because I have several emails. Please post your experience in using 'imapsync' - you can help a lot of people migrate from different email servers to Dovecot smile

So, good luck!

7 (edited by billybons2006 2010-06-11 22:14:26)

Re: Migration from Kerio Mail Server

For webmaster - code's areas are very high! I don't know how reduce height.


Re: Migration from Kerio Mail Server

Thanks very much for your sharing. smile


9 (edited by billybons2006 2010-06-15 21:08:42)

Re: Migration from Kerio Mail Server

I can place the perl script, which describes, how can be organized the process of migration:
1. copymail.pl (perl script)


$options="--noauthmd5 --sep1=s --prefix1=s";

open(FILE,"<",$filename) || die "$!\n";
while(<FILE>) {
        @F = split;
        $from="--host1 $F[2] --user1 $F[0] --password1 $F[1]";
        $to="--host2 $F[5] --user2 $F[3] --password2 $F[4]";
        # if done well, return 0, otherwise return not 0.
        system("imapsync $options $from $to");
        $value = $?>>8; # shift return code from system to imapsync
        # if returned value is 0, that's all right.
        # Only for your addtional control.
        print "$value\n";

2. emails2migrate.txt

mail1@ddd.ccc  password1  hostname1  mail2@eee.rrr password2 hostname2

If password1 and password2 are the same, you can edit the script (1):

        $from="--host1 $F[2] --user1 $F[0] --password1 $F[1]";
        $to="--host2 $F[4] --user2 $F[3] --password2 $F[1]";

and the script (2):

mail1@ddd.ccc  password1  hostname1  mail2@eee.rrr hostname2

You see, it pretty easy!

I have to note about options:

$options="--noauthmd5 --sep1=s --prefix1=s";

My server1 needs options --sep1 and --prefix1. By default I was trying only with --noauthmd5.


Re: Migration from Kerio Mail Server

In additional, if you have manually created folders in IMAP accounts, you can face troubles with copying emails from old server, because imapsync cannot be able to create folders and even you create folders on servers2 manually, imapsync with pretty high percent will not use its.
May be its because of differs encoding, I don't know. If you have your opinion, I'll be gratefull for your comments!
PS: Sorry for grammatic! I have only a few minutes to write this message.

11 (edited by billybons2006 2010-06-15 21:33:05)

Re: Migration from Kerio Mail Server

Another way to migrate (from official manual):
If you have many mailboxes to migrate think about a little shell
    program. Write a file called file.csv (for example) containing users and
    passwords. The separator used in this example is ';'

    The file.csv file contains:

    user0011;password0011;user0012;password0012 ...

    And the shell program is just:

{ while IFS=';' read  u1 p1 u2 p2; do 
   imapsync --user1 "$u1" --password1 "$p1" \
     --user2 "$u2" --password2 "$p2" ...
done ; } < file.csv

A bit easy, than my method wink I find official method 1 minutes ago wink