In this article I describe how to configure Z-Push to use a Roundcube contacts database to allow synchronisation of contacts on a smartphone or tablet using ActiveSync.
We host email for a number of our clients and provide several methods of access, including the popular webmail frontend Roundcube. As well as all of the email features you would expect, Roundcube includes a full featured address book. This was all well and good when we started providing email hosting, but with the increase in smart mobile devices in recent years, the inability to use the Roundcube address book outside of the Roundcube webmail frontend has been an increasingly significant limitation.
We also use Zarafa, another open source webmail system, which incorporates many more advanced groupware features. It includes a component called Z-Push, which is an open source implementation of Microsoft's ActiveSync protocol. ActiveSync is the means by which most smart devices (Apple iOS, Google Android and Microsoft Windows Phone) synchronise mail, contacts, calendars, etc.
Z-Push is closely tied to Zarafa, but can also be configured to use an alternative backend such as a standard IMAP server. When configured in this way it does not offer all the same features as Zarafa, but it is still useful. We've wanted to offer Roundcube contact sync via ActiveSync for a while, but writing an entire new backend for Z-Push was just too big a task to fit in around our working schedule — we are only a small team!
Yesterday I revisited this problem and discovered that there is now a Z-Push backend for Roundcube. It was written by Alex Charrett and can be found on his website. I decided to give it a try but quickly ran into a problem: the authentication system he has written assumes that your users and their (hashed) passwords are stored in a MySQL database. This is not the case for our setup. However, it turned out to be fairly simple to work around. I rewrote the login function to authenticate using IMAP instead. This has the downside of requiring that PHP includes the IMAP module (package
php5-imap on Ubuntu/Debian), but the advantage that it should work on any Roundcube setup, as Roundcube uses IMAP to access the users' mail.
To use our version of the Roundcube backend for Z-Push, follow these steps:
- Set up Z-Push as normal.
- Download the Roundcube backend code from GitHub.
- Copy the file
roundcubecontacts.phpinto the backend folder.
- Open the Z-Push
config.phpfile in a text editor.
- Save the file.
Current limitations: The IMAP login is currently hardcoded to connect to localhost via SSL. We will change this to a config option in future. Ideally, we would like to unify email sync and contact sync into one Z-Push backend. At the moment, it is necessary to synchronise email using an IMAP account and contacts using a separate ActiveSync account. Z-Push includes an IMAP backend so incorporating it into this Roundcube backend should be straightforward.