Migrate accounts from Kerio Connect to Zimbra Collaboration with ImapSync

In Guides, Linux, Technology by Kevin MaschkeLeave a Comment

In previous posts we saw what Zimbra Collaboration is, which prerequisites are necessary for its installation, how to install and configure DNSMasq and finally, how to install Zimbra.

Now we’re going to see how to migrate our accounts from a Kerio Connect server to a Zimbra Collaboration server, since this was my case. To do this, we will use a free product called ImapSync. There is other software that can be used for this migration, some even based on ImapSync, but I tried a few, some with a graphical interface and some through the command line, and none did end up working correctly or as I needed between these two servers. Maybe it was me just doing something wrong, but with ImapSync I was able to achieve the results I needed.

Some considerations

PLAIN Authentication

First, ImapSync requires PLAIN authentication to be enabled in Zimbra. This can be done in Configuration > General Configuration > Proxy > Proxy Congiguration for mail

PLAIN Authentication

Size Limits

This may or may not be necessary depending on the size of the accounts you are going to migrate, and the size of the emails and attachments. If you are not sure how big your accounts, its emails and attachments are, I’d suggest to increase the maximum allowed sized in Zimbra, and decrease them again later, once the migration is complete.

First, verify the current maximum allowed sized, configured by default in Zimbra. I suggest copying these values so you can reset them later.

zmprov getConfig zimbraFileUploadMaxSize
zimbraFileUploadMaxSize: 10485760
zmprov getConfig zimbraImapMaxRequestSize
zimbraImapMaxRequestSize: 10240
zmprov getConfig zimbraMailContentMaxSize
zimbraMailContentMaxSize: 10240000
zmprov getConfig zimbraMtaMaxMessageSize
zimbraMtaMaxMessageSize: 204857600

Configure new size limits:

zmprov modifyConfig zimbraFileUploadMaxSize 150000000
zmprov modifyConfig zimbraImapMaxRequestSize 150000000
zmprov modifyConfig zimbraMailContentMaxSize 150000000
zmprov modifyConfig zimbraMtaMaxMessageSize 150000000

Check that the changes have been applied correctly:

zmprov getConfig zimbraFileUploadMaxSize
zmprov getConfig zimbraImapMaxRequestSize
zmprov getConfig zimbraMailContentMaxSize
zmprov getConfig zimbraMtaMaxMessageSize

Restart mailboxctl:

zmmailboxdctl restart


With the information of the official ImapSync website, its GitHub site and the Zimbra Wiki, I did a few tests with some fake accounts until I managed to migrate/sync all folders and emails between Kerio Connect accounts and Zimbra Collaboration accounts. The final command I used was the following:

imapsync --nosyncacls --subscribe --syncinternaldates --nofoldersizes --skipsize --noauthmd5 --host1 --user1 user1@domain.com --password1 123456 --host2 --user2 user2@domain2.com --password2 123456 -authmech2 PLAIN --ssl2

The following were the options I used:

Don't sync ACLs (Listas de Control de Acceso). Enabled by default.
Subscribe to transferred folders on Server2 if subscribed on Server1. Enabled by default.
Sync the original mail dates.
Do not calculate the folder size before syncing them. By default it does calculate it, but we want to sync everything either way, so there's no point.
Ignore sizes. Enabled by default.
Don't use MD5 for the Authentication. Enabled by default.
--authmech2 PLAIN 
Authentication mechanism on Server2 (Zimbra).
Use SSL on Server2 (Zimbra) if possible. Enabled by default.

Monitor the logs

Something very important which I recommend to to is to monitor the logs during each migration. This way you can see at all times what is being done and if any error occurs. To do so, we can use the simple command tail:

tail -f log/mailbox.log | grep -i warn

Calendars and Contacts

ImapSync does not migrate calendars or contacts between servers and accounts, only folders and emails. In my case I simply exported the calendars and contacts from the accounts on the Kerio Connect server and imported them into the accounts on the Zimbra Collaboration server. There are other ways to do this, for example through Microsoft Outlook, the migration app from Zimbra or other software, but in my case the number of accounts was not too big and I was able to do this manually.

And here ends this tutorial! There are probably other ways to migrate accounts and emails between Kerio Connect and Zimbra Collaboration, but I did not find any that worked better for me than ImapSync and I personally think that it’s one of the most secure, fast and best methods. Try it out and let me know how it went or if you know any better alternative!

Want to say something? Leave a comment!