As a few of you may have realised, im a great fan of Zimbra however one real short coming is the lack of ability to sync contacts and for real time push email – instead having hack around with Funambol and/or rely on IMAP/POP for email. In the Opensource edition anyway.
For me, i just could not justify the expense of the Network Edition license for ActiveSync and back-up – so i set about finding opensource equivalents to allow me to get the functionality i required. Now whilst this may not scale well for larger deployments, for me it does what i need! If Zimbra offered a more sensible licensing model, that would make Network Edition plausible for 5 users (rather than the 25 user minimum) then i would go down this route…..as it stands they dont, so one of the beauties of opensource software is being able to find alternatives for free!
Another solution for email is to use Zarafa, however its not quite an all in one solution like Zimbra and i have to confess that the webmail is too much like ‘Outlook’ for me! However, it does have one thing going for it and thats the inclusion of ‘Z-Push’. Z-Push is a PHP based opensource ActiveSync solution – ie a way to sync systems other than Exchange with Windows Mobile, Apple iPhone, Android etc. In this case, we’re going to use Z-Push with a specific Zimbra backend plugin to enable push email and syncing of calendar and contacts to an iPhone – without stumping for the Zimbra Network Edition license cost.
You can read more about Z-Push here:
http://z-push.sourceforge.net/soswp/
The above combined with the below, and an Apache server, is all we need:
http://sourceforge.net/projects/zimbrabackend/
So first we need to download Z-Push to our web root, im doing this via an SSH session – utilising version 1.3 RC2 of Z-Push:
billabong:/home/sync/public_html# wget http://download.berlios.de/z-push/z-push-1.3RC2.tar.gz
–2010-02-17 15:08:33– http://download.berlios.de/z-push/z-push-1.3RC2.tar.gz
Resolving download.berlios.de… 195.37.77.141
Connecting to download.berlios.de|195.37.77.141|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 106534 (104K) [application/x-download]
Saving to: `z-push-1.3RC2.tar.gz’
100%[======================================>] 106,534 –.-K/s in 0.1s
2010-02-17 15:08:34 (813 KB/s) – `z-push-1.3RC2.tar.gz’ saved [106534/106534]
billabong:/home/sync/public_html#
Now we unzip/untar the package
billabong:/home/sync/public_html# tar zxvf z-push-1.3RC2.tar.gz
z-push/
z-push/state/
z-push/include/
z-push/include/z_RFC822.php
z-push/include/mimeDecode.php
z-push/include/utils.php
z-push/include/z_ical.php
z-push/include/z_tnef.php
z-push/backend/
z-push/backend/diffbackend.php
z-push/backend/vcarddir.php
z-push/backend/ics.php
z-push/backend/maildir.php
z-push/backend/imap.php
z-push/backend/backend.php
z-push/wbxml.php
z-push/memimporter.php
z-push/LICENSE
z-push/zpushdefs.php
z-push/zpushdtd.php
z-push/proto.php
z-push/config.php
z-push/statemachine.php
z-push/index.php
z-push/streamer.php
z-push/INSTALL
z-push/version.php
z-push/streamimporter.php
z-push/compat.php
z-push/request.php
z-push/debug.php
billabong:/home/sync/public_html#
Next we set permissions 777 for the ’state’ directory, so that the web server can write files – note you could restrict this further if you so desire, ie so that just the user that Apache runs as can write to it:
billabong:/home/sync/public_html# chmod 777 z-push/state
billabong:/home/sync/public_html#
Now we need to edit the Apache configuration , to add an alias:
Alias /Microsoft-Server-ActiveSync /home/site/public_html/z-push/index.php
This will depend on the version of Apache that youre using, for me its Apache2 – the configuration file for my virtual host is stored at /etc/apache2/sites-enabled/
Add the above line, customising as you need, to the correct virtual host configuration file for which you wish to enable Z-Push – if you do not have access to your Apache config then this will not work! Because i want to use this over HTTPS, i need to make sure i add it to the correct virtual host, ie with the SSLEngine on and running on port 443:
<VirtualHost xxx.xxx.xxx.xxx:443>
SuexecUserGroup “#1003″ “#1004″
ServerName sync.fubar.com
Alias /Microsoft-Server-ActiveSync /home/sync/public_html/z-push/index.php
DocumentRoot /home/sync/public_html
….
SSLEngine on
….
</VirtualHost>
We now have the basics of Z-Push set up, however we dont yet have it connecting to Zimbra’s SOAP interface to retrieve email, contacts and calendar entries. This is where the Z-Push Zimbra Backend comes in…
Next we go back to the directory to where we downloaded and extracted Z-Push to, inside this directory is another called ‘backend’:
billabong:/etc/apache2/sites-enabled# cd /home/sync/public_html/z-push
billabong:/home/sync/public_html/z-push# ls
backend include memimporter.php statemachine.php wbxml.php
compat.php index.php proto.php streamer.php zpushdefs.php
config.php INSTALL request.php streamimporter.php zpushdtd.php
debug.php LICENSE state version.php
billabong:/home/sync/public_html/z-push# cd backend/
billabong:/home/sync/public_html/z-push/backend# ls
backend.php diffbackend.php ics.php imap.php maildir.php vcarddir.php
These are the different options we have to interface with Z-Push, as you can see there is currently no Zimbra. Lets fix that – note at time of writing revision 18 didnt work for me, revision 16 however does – checking out from subversion/svn you will get the latest by default, however from SourceForge you can also just download specific versions. Clicking on the revision number, ie 16, from the following URL http://sourceforge.net/projects/zimbrabackend/develop, allows you to download just that version. Then click on ‘zimbra.php’, there will then be a ‘download’ link, right click and copy and then use wget with the URL copied to your clip board. We then rename the downloaded file to be just ‘zimbra.php’, note this MUST exist in the backend directory inside Z-Push:
billabong:/home/sync/public_html/z-push/backend# wget “http://zimbrabackend.svn.sourceforge.net/viewvc/zimbrabackend/zimbra.php?revision=16&pathrev=16″
–2010-02-17 15:33:15– http://zimbrabackend.svn.sourceforge.net/viewvc/zimbrabackend/zimbra.php?revision=16&pathrev=16
Resolving zimbrabackend.svn.sourceforge.net… 216.34.181.65
Connecting to zimbrabackend.svn.sourceforge.net|216.34.181.65|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [text/plain]
Saving to: `zimbra.php?revision=16&pathrev=16′
[ <=> ] 110,039 267K/s in 0.4s
2010-02-17 15:33:16 (267 KB/s) – `zimbra.php?revision=16&pathrev=16′ saved [110039]
billabong:/home/sync/public_html/z-push/backend# mv zimbra.php\?revision\=16\&pathrev\=16 zimbra.php
billabong:/home/sync/public_html/z-push/backend# ls
backend.php ics.php maildir.php zimbra.php
diffbackend.php imap.php vcarddir.php
billabong:/home/sync/public_html/z-push/backend#
So now we have the required files, we just need to configure Z-Push with the Zimbra backend – edit the config.php file in the z-push root directory and add the following lines:
define(‘ZIMBRA_URL’, ‘https://URL-TO-ZIMBRA’);
define(‘ZIMBRA_SYNC_CONTACT_PICTURES’, true);
define(‘ZIMBRA_VIRTUAL_CONTACTS’,true);
define(‘ZIMBRA_VIRTUAL_APPOINTMENTS’,true);
define(‘ZIMBRA_VIRTUAL_TASKS’,true);
define(‘ZIMBRA_IGNORE_EMAILED_CONTACTS’,true);
define(‘ZIMBRA_HTML’,true);
Note im using HTTPS to connect to Zimbra, you may need to modify this to HTTP if required. Then in the same config.php file, edit the variable to make Z-Push use the Zimbra backend:
$BACKEND_PROVIDER = “BackendZimbra”;
That should be pretty much it…fire up your iPhone, or which ever device you wish to use! Note, you dont need to enter a ‘domain’ in the mobile configuration, just leave that blank.
A couple of gotcha’s i came across:
- Folder names cannot have .’s in, this will break the sync for further email folders and/or contacts/calendar.
- One or two folders for some reason did not display on the mobile device, creating a new folder copying the mail over and then renaming the folder worked fine for me
- When adding calendar/contacts entries from the phone, these are synced to Zimbra and then back down again – creating a duplication. This was/should be fixed in Zimbra backend revision 18, however i had some problems with that release!