Mail Migration: Difference between revisions

Line 8: Line 8:

GertThiel originally posted [[Guide_to_imapsync|this guide]] to the zimbra forums.
GertThiel originally posted [[Guide_to_imapsync|this guide]] to the zimbra forums.
related forum links: <br>

==== Kerio ====
==== Kerio ====

Revision as of 23:31, 27 April 2009

Note: the first step in migrating users is to create the accounts, this is a topic of its own at Bulk Create

from IMAP

using imapsync (Recommended Method)

Currently, the recommended method for migrating users to Zimbra from an existing IMAP server is with the imapsync tool written by Gilles Lamiral. When in doubt, please refer to the documentation for your version of imapsync for up-to-date options and settings.

GertThiel originally posted this guide to the zimbra forums.

related forum links:


Only mail can be migrated at the moment. Using the following imapsync command to migrate emails from a single user to zimbra

   perl imapsync --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates \
   --host1 --user1 --password1 keriopasswd --sep1 "/" --prefix1 "" \
   --host2 --user2 --password2 zimbrapasswd


See User Migration From Dovecot With External LDAP

using YippieMove (Commercial Method)

Note: this was probably originally added by someone from YippieMove (User:Gettyless)

YippieMove is a SaaS for email migration. The service allows you move between any two email providers that supports IMAP, including Zimbra. No download is required and all transfers are performed on their servers. YippieMove charges $14.95 per account transfered (volume discount available). A screencast is available here.



pop2imap is a tool used to get a pop inbox and syncronise it to an IMAP folder. You can get it from [1]

It is very similar to imapsync above.

   pop2imap  \
   --host1 --user1 yourAccount --passfile1 yourPasswordFile \
   --host2 --user2 yourZimbraAccount --passfile2 yourZimbraPasswordFile \
   --folder MyOldPOPMail

Will copy the INBOX on your pop account to MyOldPOPMail folder.

There are some problems with pop2imap though.

  • It will not create the folder, you must have that manually created
  • It does not support SSL, however this is easy to do with "stunnel" - providing the SSL tunnel to the server
  • It downloads all of the messages first to get headers, although some pop servers do this well, many do not and this is a very time consuming operation. Modifications to the script are simple to skip this step and force a copy of the mail (technically no longer a sync, but a straight copy).


imap_tools ( has has batch mode with lists built in for all activities...POP3-IMAP, IMAP-IMAP...

from Exchange

There are a least two ways to migrate the content of the individual MS Exchange user. First, is to use the Zimbra Migration Wizard. Second, is to export the contents of the MS Exchange folders to a .pst file and import them using the Zimbra PST Import Wizard. A third option is to export the MS Exchange data to a .pst file and restore it once the Zimbra profile is created for a corresponding Zimbra user either through the Zimbra Connector for Outlook or through IMAP.

See forums: Migration from Exchange

Information on using the Zimbra Exchange Migration Wizard can be found in the Migration Wizard for Exchange Installation Guide.

separate wiki page is here -- Migrating from Exchange

from Outlook

If you are using Outlook without Exchange, you can import the local mail folders directly into Zimbra with the PST Import Wizard.

from Lotus Notes/Domino

Lotus Notes/Domino to ZCS can be found in the Migration Wizard for Domino Installation Guide

from iMail

The first step is to export the users information including the password. I used this utility for CommuniGate Pro which creates a fixed length file. I then coverted it to a Tab-Delimited file with this utility so that I could use the Bulk Create process. After you create your Domains and provision the accounts, turn on IMAP4 for iMail and use the IMAP migration process.

from mbox files

The mbox file format is commonly used by many programs, most notably sendmail. The advantage of migrating from mbox files is that no passwords or special accounts are needed. There are several scripts that people have submitted to the wiki:

mbox > Maildir > Zimbra hash-dirs

If the mbox file can be converted to maildir format, you can use the zmmailbox utility to add messages to a user's mailbox. This will preserve the original time and date information, and will allow administrators to sort the mail into folders giong through IMAP.

OR zmlmtpinject

Usage for both outlined here:

# mbox2maildir: coverts mbox file to maildir directory - the reverse of
# maildir2mbox from the qmail distribution.
# Usage: mbox2maildir uses the same environment variables as maildir2mbox:
# MAILDIR is the name of your maildir directory; MAIL is the name of your
# mbox file; MAILTMP is ignored.  MAIL is deleted after the conversion.
# WARNING: there is no locking; don't run more than one of these!  you
# have been warned.
# based on convert-and-create by Russell Nelson <>
# kludged into this by Ivan Kohler <> 97-sep-17
require '';
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{QUIT} = 'IGNORE'; 
local $SIG{TERM} = 'IGNORE';
local $SIG{TSTP} = 'IGNORE';
($name, $passwd, $uid, $gid, $quota, $comment, $gcos, $dir, $shell) =
die "fatal: home dir $dir doesn't exist\n" unless -e $dir;
die "fatal: $name is $uid, but $dir is owned by $st_uid\n" if $uid != $st_uid;
chdir($dir) or die "fatal: unable to chdir to $dir\n";
$spoolname = "$ENV{MAILDIR}";
-d $spoolname or mkdir $spoolname,0700
  or die("fatal: $spoolname doesn't exist and can't be created.\n");
chdir($spoolname) or die("fatal: unable to chdir to $spoolname.\n");
-d "tmp" or mkdir("tmp",0700) or die("fatal: unable to make tmp/ subdir\n");
-d "new" or mkdir("new",0700) or die("fatal: unable to make new/ subdir\n");
-d "cur" or mkdir("cur",0700) or die("fatal: unable to make cur/ subdir\n");
open(SPOOL, "<$ENV{MAIL}")
  or die "Unable to open $ENV{$MAIL}\n";
$i = time;
while(<SPOOL>) {
  if (/^From /) {
    $fn = sprintf("new/%d.$$.mbox", $i);
    open(OUT, ">$fn") or die("fatal: unable to create new message");
  s/^>From /From /;
  print OUT or die("fatal: unable to write to new message");

from Maildir

from Thunderbird Local Folders

lots of local folders => mbox => dovecot => imapsync

The easiest way I found for importing a lot of Thunderbird local folders is to set up a temporary dovecot server, convert the thunderbird mail stores to linux mbox mailstores and then imapsync it from the temp server to the zimbra server:

  • Install dovecot on a temporary server. On Debian etch: apt-get install dovecot-imapd, and then edit /etc/dovecot.conf and set the protocols to include imap. Restart dovecot. That is enough for our purposes.
  • Download the nstouwimap script here: It will be used to convert Thunderbird mailboxes to mbox files that can be read by dovecot.
  • Copy All the local folders from all users to the server.
  • Create a transfer user on the dovecot server.
  • In the user's home directory, create a mail folder: /home/transferuser/mail.
  • For each mailbox, do the following (this can be scripted):
    • Clear the old mail folder on the server: rm -rf /home/transferuser/mail/*
    • Run nstouwimap /path/to/user/LocalFolders /home/transferuser/mail to convert the Local Folders to the transfer user's dovecot mailbox.
    • Run imapsync to transfer the account over to zimbra.
Jump to: navigation, search