The iPhone does not support the IMAP Idle protocol to receive push notifications for new emails. Fortunately the open source project Z-Push implements the ActiveSync protocol which can be also used by iOS to receive push email notifications.
If you followed my other articles on how to install a mail server on Ubuntu, you have a running Dovecot server. You also need a running Apache server with PHP5. The server has to respond to https requests. If your server meets these requirements, adding Z-Push to this setup is easy.
Download the latest Z-Push version from here. At the time of writing the most recent version is 2.1.0.
Now install necessary Ubuntu packages:
Unpack Z-Push and move the folder into your https directory:
Z-Push needs two additional working directories:
Now it’s time to modify the Z-Push configuration file
config.php. You only need to set the timezone and the backend provider. Anything else can be left on default.
The last step is to set an alias address to the z-push folder in the Apache virtual host configuration:
You can test if the server is setup properly by opening the url
https://YOUR_DOMAIN/Microsoft-Server-ActiveSync in the browser. You will be prompted for username and password. After you enter your login credentials, the server will answer
GET not supported. If you get this message, you are all setup.
On the iPhone you now have to create a new Exchange mail account and you are done.