Migrating mailboxes from Zarafa to Dovecot/OpenChange
This document covers migrating the mail accounts of your users from the Zarafa module of Zentyal to a regular Maildir format, and hence, compatible with OpenChange.
We start with a Zentyal 3.0/3.2 host, configured to use Zarafa.
We have some users:
And some content in their Zarafa mail accounts:
We will install the git package, clone the python-zarafa repository, and install:
# apt-get install git # git clone https://github.com/zarafagroupware/python-zarafa.git # cd python-zarafa
Download the zarafa-export-openchange script:
# wget https://raw.githubusercontent.com/jbahillo/zarafa-export/master/zarafa-export-openchange.py
We will need to modify line 351 of the following file:
root@zentyalold:~/python-zarafa# vim zarafa/__init__.py +351
Deleting the last parameter of the function call, so it looks like this
for username in AddressBook.GetUserList(self.mapisession, None): # XXX sa.GetUserList broken for unicode?
Create a directory to store your mailboxes:
# cd # mkdir mailmigration # cd mailmigration
And call the zarafa-export script using relative path (so you don't mix scripts with user data):
root@zentyalold:~/mailmigration# python ../python-zarafa/zarafa-export-openchange.py user: jsmith folder: count=0 size=0 Drafts folder: count=2 size=5774 Sent Items folder: count=2 size=7047 Inbox user: mjones folder: count=0 size=0 Drafts folder: count=2 size=3846 Sent Items folder: count=2 size=9129 Inbox root@zentyalold:~/mailmigration#
Now you have a copy of your users' mailboxes in Maildir format:
root@zentyalold:~/mailmigration# ls jsmith mjones
You can create a tarball and copy to the destination machine, for this example:
root@zentyalold:~/mailmigration# cd .. root@zentyalold:~# tar cvfz mailmigration.tar.gz mailmigration/ ... root@zentyalold:~# scp mailmigration.tar.gz administrator@newzentyal.lan:
We will use Zentyal 3.5 as the destination host for this example (4.0 should follow the same procedure). For the mailboxes that we want to migrate, we have the same users with the same usernames. If you need to migrate your directory information first, here you have detailed how-tos on how to migrate a single domain controller or a scenario with multiple domain controllers
On this new server, we unzip the "mailbox" directory:
root@zentyal:~# tar xvfz mailmigration.tar.gz
We can copy the mailboxes to the desired mail domain:
root@zentyal:~# cd mailmigration root@zentyal:~/mailmigration# cp -ar * /var/vmail/zentyal-domain.lan/ root@zentyal:~/mailmigration# ls /var/vmail/zentyal-domain.lan/ jsmith mjones root@zentyal:~/mailmigration#
Change the owner of the copied files on the mail domain directory:
root@zentyal:~/mailmigration# chown -R ebox.ebox /var/vmail/zentyal-domain.lan/
Now, the users can access their emails in the new server using either regular IMAP or MAPI/Microsoft Outlook® client:
Please note that only mail will be exported from Zarafa into Maildir to be imported into Zentyal OpenChange. If your migration project has a considerable number of mail accounts to migrate and calendars or contacts are really important for you, please contact us to evaluate possible options: info@zentyal.com