User Migration

Migration from one mail system to another is often painful. It can result in a user having to look in two different places to find mail, or in the worst case mail disappearing.

Copying the contents of one mail system to another often seems like a good idea, that way if anything goes wrong at least the old mail is still available. Ideally you know exactly what you are going to do at the start, you move everything across, and then you kill the old mail system (or at least make it not visible from mail clients). That way users are not confused by having two sets of identical folders.

In reality you may have to learn on the job. After user data has been migrated to Zimbra, users can access their mail via the web client without any additional setup until their mail client has been configured to access the Zimbra server.

Migrating Mail

Bulk Creating the Accounts

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

Migrating from an existing IMAP server (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. The following guide to imapsync was originally posted to the forums by GertThiel:

Before you can use imapsync you must have both the source IMAP message store and ZCS up running and accessible to user accounts via IMAP. You can check that using an email client before starting the migration. You will need the login names (i.e. email addresses) and passwords for the users to be migrated. In addition, imapsync will not be able to authenticate to the Zimbra server until you enable clear text login for the IMAP service. You can set that option under the IMAP tab of the Global Settings or individual Server settings in the Zimbra Admin Console UI. There are also a few Perl module dependances, including; Digest::MD5, IO::Socket::SSL,Term::ReadKey, Digest:HMAC. You can install these with your favorite package manager, from RPM's or with cpan. Finally, consider that imapsync will be a heavy load on your CPU and memory; the system running the migration will be less responsive.

For this example my existing IMAP server is running on server.gtds.lan and I set up Zimbra on a new machine named zimbra.gtds.lan.

   imapsync --nosyncacls --syncinternaldates \
   --host1 server.gtds.lan --user1 yourAccount --password1 yourPassword \
   --host2 zimbra.gtds.lan --user2 yourZimbraAccount --password2 yourZimbraPassword

Of course the complete command belongs on one line (signified by the backslashes: \).

A slightly more secure method is to write each password into a seperate file, and then use the --passfile{1|2} options intead of the --password{1|2} options:

   imapsync --nosyncacls --syncinternaldates \
   --host1 server.gtds.lan --user1 yourAccount --passfile1 yourPasswordFile \
   --host2 zimbra.gtds.lan --user2 yourZimbraAccount --passfile2 yourZimbraPasswordFile

If your old IMAP server doesen't support NAMESPACE you have to also add appropriate options for example on iMail 6.0 --sep1 . --prefix1 INBOX. are required.

You may interrupt imapsync at any time with CTRL-C. Simply restart the same command again to resume the migration. You can also run it more than once to sync changes for a staged migration.

I used imapsync to migrate from a Cyrus IMAPd to Zimbra. The ReadMe lists a number of other IMAP servers compatible with imapsync.

SSL

You can also do SSL version of imapsync, by calling the "imapsync-ssl" and providing "--ssl1" and/or "--ssl2" for each of the accounts you wish to migrate.

Batch Proccessing

You can automate multiple users by using this script.

    #!/bin/bash
    
    logfile="sinklog.txt"
    
    host1=123.123.123.123
    #host1 is Source
    
    host2=321.321.321.321
    #host2 is Dest
    
    domain=xyz.com
    #domain is where email account is
    #everything after @ symbol
    
    ###### Do not modify past here
    #######################################
    
    date=`date +%X_-_%x`
    
    echo "" >> $logfile
    echo "------------------------------------" >> $logfile
    echo "IMAPSync started..  $date" >> $logfile
    echo "" >> $logfile
    
    { while IFS=';' read  u1 p1; do 
            user=$u1"@"$domain    
    	     echo "Syncing User $user"
            date=`date +%X_-_%x`
            echo "Start Syncing User $u1"
            echo "Starting $u1 $date" >> $logfile
    imapsync --nosyncacls --syncinternaldates --host1 $host1 --user1 "$user" --password1 \ 
    "$p1"--host2 $host2 --user2 "$user" --password2 "$p1"
            date=`date +%X_-_%x`
            echo "User $user done"
            echo "Finished $user $date" >> $logfile
            echo "" >> $logfile
    
            done ; } < userlist.txt
    
    date=`date +%X_-_%x`
    
    echo "" >> $logfile
    echo "IMAPSync Finished..  $date" >> $logfile
    echo "------------------------------------" >> $logfile

Now create a CSV file with the user names and passwords in the following format.

    user;password
    user2;password2

Migrating from POP3

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 some.pop.com.au --user1 yourAccount --passfile1 yourPasswordFile \
   --host2 zimbra.imap.com.au --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 SLL, 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).


Migrating from Dovecot

See User_Migration_From_Dovecot_With_External_LDAP

Migrating 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.

Migrating from Exchange

There are a least two ways to migrate the content of the individual MS Exchange user. First, is to use Zimbra Wizard. Second, is to export the content of MS Exchange to .pst file and restore it once Zimbra profile is created for a corresponding Zimbra user.

See forums: Migration from Exchange

Migrating from Lotus Notes/Domino

Migrating Contacts and Calendar

If your mail migration strategy doesn't cover contacts and calendar, you can import via the REST interface. (Currently, contacts and calendar are only imported with the Exchange migration tool, so this applies to most IMAP migrations).

Procedure Overview

The basic procedure is this:

  1. Export calendar or contact data from your existing server into a csv or ics file
  2. Migrate that data file to a host that can access the zimbra server
  3. Use the REST interface to insert the data into Zimbra

REST overview

Today, within the Zimbra Collaboration Suite we have a number of different server-side URLs that our client accesses to download an attachment, export contacts as CSV, export a calendar as an ICS, file etc. We are also adding sharing (what would collaboration be without sharing, after all) of calendars, contacts, etc. Not only within a particular Zimbra community, but between Zimbra communities and the public at large.

In order to facilitate this, we are coming up with a clean, consistent URL interface to all our resources. The best way to describe this is with some examples.

Lets say I want access to my calendar folder from within iCal. The URL would look like:

 http://server/zimbra/user/roland/calendar

The default format on calendar folders is ICS, so no need to specify the format.

Lets say I want to export my contacts folder so I can import them into another account:

 http://server/zimbra/user/roland/contacts

Contact folders have a default type of CSV, so like calendars, no need to specify the format.

How about an RSS feed of unread messages in my inbox:

 http://server/zimbra/user/roland/inbox.rss?query="is:unread"

By specifying an extension of ".rss" on the inbox folder, the server will automatically generate an RSS feed on it. Adding the "query" parameter lets me further refine what gets returned. You can also specify "?fmt=rss" instead of using the ".rss" extension if you'd like.

Lets do something a little more interesting. How about a zip file containing all messages in my talks/ajax folder:

 http://server/zimbra/user/roland/talks/ajax.zip

The server zips them all up and returns the zip file.

Another interesting example is say you have created a public calendar that you want to share with everyone. Once you have granted access to the calendar, it is up to the consumer to chose what format they want to view it in:

 http://server/zimbra/user/roland/calendar/talks.ics
 http://server/zimbra/user/roland/calendar/talks.html?view=month
 http://server/zimbra/user/roland/calendar/talks.atom
 http://server/zimbra/user/roland/calendar/talks.xml
 http://server/zimbra/user/roland/calendar/talks.txt

How about accessing another user's calendar/folder? Once they grant you access, you can use the same exact syntax:

 http://server/zimbra/user/janie/holidays.ics

One last interesting example to leave you with. Lets say you have a friend at widgets.com who you know is running Zimbra and who has shared their calendar with you, but you don't know the name of their public Zimbra server. As long as they publish some DNS SRV records for _zimbra._tcp.widgets.com, then you can access it directly from your Zimbra without needing to know his server's address:

 http://server/zimbra/user/friend@widgets.com/calendar

REST file formats

We are supporting a number of different "formats" for returned data. The formats we currently have implemented are:

REST file formats
Format Description
For generating an ATOM feed of mail messages and calendar appts.
For exporting contacts.
For exporting calendar appointments. See RFC 2445.
Calendar free/busy data. See RFC 2445.
Default formatter used to output messages and attachments in their "native" format. Used by the web client to reference attachments for downloading.
For generating an RSS feed of mail messages and calendar appts.
Similar to the native formatter, used by sync clients to retrieve raw message data, along with some extra meta-data in the HTTP |- (tags, flags, received date).
For exporting a set of messages (folder or search result) as a ZIP file.

Here are some sample URLs for the various formatters.

ATOM

 http://server/zimbra/home/schemers/inbox.atom  

Returns an Atom feed for all messages in the inbox. If you only want unread messages as part of the feed, you could include a search query:

 http://server/zimbra/home/schemers/inbox.atom?query="is:unread"

You can also request an Atom feed of a calendar folder as well:

 http://server/zimbra/home/schemers/calendar.atom  

Note that "calendar" is the pathname to the folder called "calendar", it isn't a special-cased pathname. If you had a calendar folder called "talks", then you can access that folder via:

 http://server/zimbra/home/schemers/talks.atom  

When used with a calendar folder, the Atom feed will (by default) generate a feed of all appointments -/+ 7 days from the current time. To specify a different time range, you can use the start/end query parameters:

 http://server/zimbra/home/schemers/calendar.atom?start=0days&end=30days  

The time range can be specified in a number of different formats:

(milliseconds UTC) MM/DD/YYYY YYYY/MM/DD {relative dates}

relative dates are either in the future (p/+/{not-specified}) or the past (m/-), along with a numeric value, followed by the units.

For units, everything after the first character is ignored (except for the "mi" case): m(onths) mi(nutes) d(ays) w(eeks) h(ours) y(ears)

Examples: 1day 1 day from now +2days 2 days from now p1day 1 day from now -2days 2 days ago +60mi 60 minutes from now +1week 1 week from now +6mon 6 months from now 1year 1 year from now

The start/end query parameters apply to the atom, ics, rss, and ifb formatters.

CSV

 http://server/zimbra/home/schemers/contacts.csv  

Exports all contacts in the contacts folder. If you want to export only contacts tagged "zimbra", you can specify a query:

 http://server/zimbra/home/schemers/contacts.csv?query="tag:zimbra"  

This will only export contacts that are tagged with "zimbra".

ICS

 http://server/zimbra/home/schemers/calendar.ics  

Will export all appointments in the calendar folder in the ICS format, suitable for import into a calendar client such as Apple's iCal, or Mozilla's Sunbird calendar client.

IFB

 http://server/zimbra/home/schemers/calendar.ifb?start=0d&end=60d  

Will export the free/busy data in the calendar folder for the next 60 days. Note that this is the free/busy data for the calendar folder only. If someone has multiple calendar folders then you'd want to use the following URL instead:

 http://server/zimbra/home/schemers/?fmt=ifb&start=0d&end=60d  

That URL will return free/busy data across all calendars that are configured to be included in free/busy data.

NATIVE

The native formatter is used to request raw RFC 822 messages (for example, to implement "show original") or to down an attachment. For example, lets assume that message id 376 in my inbox is a multipart/mixed MIME message, and part 2 is an image.

The following URL (which is normally generated automatically when you are viewing your mail and click on an attachment), would download that attachment and display it in your browser:

 http://server/zimbra/home/schemers/?id=376&part=2  

Lets say part 3 in that same message is a word doc, you could display that via:

 http://server/zimbra/home/schemers/?id=376&part=3  

Finally, lets say you have the Network edition installed and want to view that same word doc as HTML instead of downloading the word doc and opening it up as an attachment. Adding "view=html" to the end of the URL will convert the word doc to HTML:

 http://server/zimbra/home/schemers/?id=376&part=3&view=html  

An upcoming release will expose this functionality directly in the web UI.


RSS

 http://server/zimbra/home/schemers/inbox.rss  

Returns an RSS feed for all messages in the inbox. All the other examples given for the Atom formatter also apply to the RSS formatter.

One further note on both the Atom and RSS formatters is that the calendar feeds provided by them currently only include the title/notes data. As soon as a more complete server-side I18N infrastructure is in place (we have been focused on the web client) the Atom/RSS feeds for calendars will be much more detailed.

SYNC

The sync formatter is similar to the native formatter, with the only exception being it adds some extra meta-data to the output for sync clients.

ZIP

The Zip formatter allows you to request a set of messages (currently only mail messages, at some point will probably allow attachments/contacts/appts as well) returned to you as a Zip file.

For example, if you want a copy of all messages in your inbox, you could use the following URL:

 http://server/zimbra/home/schemers/inbox.zip  

If you wanted all messages across all folders that were from Ross, you could use a query that returned only those:

 http://server/zimbra/home/schemers/?fmt=zip&query="from:ross"  

The zip file will consist of a set of RFC822 files, with the name of the file based on the subject of the message.

Importing into Zimbra

Jump to: navigation, search