Push Email with Dovecot Mail Server
I have been looking for push e-mail since i got my iphone. Just found sth for my test server and it works for me…
I have a webserver running cPanel, Dovecot and suPHP. ( centOS 5.4, WHM 11.25 )
Steps:
1- You can download z-push from here.
2- Upload z-push to /usr/local/apache/htdocs
3- Change ownership to nobody because it fails if you leave it as root
4- If you are using suPHP than Modify index.php
Comment out $requestheaders = apache_request_headers(); and replace it with
function getHeaders() { $headers = array(); foreach ($_SERVER as $k => $v) { if (substr($k, 0, 5) == "HTTP_") { $k = str_replace('_', ' ', substr($k, 5)); $k = str_replace(' ', '-', ucwords(strtolower($k))); $headers[$k] = $v; } } return $headers; } $requestheaders = getHeaders(); |
5- Modify config.php
Change $BACKEND_PROVIDER = “BackendICS”; to $BACKEND_PROVIDER = “BackendIMAP”;
6- Add the alias to httpd. conf as explained in the config file, but use /usr/local/apache/htdocs instead of /var/ www
7- Restart Apache
8- Go to your iPhone and set up your e-mail account as a Microsoft Exchange account. (Be sure to sync “All messages” or else you’ll be deleting things twice.)
9- Thats All. You now have push email on your iPhone..
10- You may need to modify backend/diffbackend.php to make it delete properly.
Find the following code:
function ImportMessageMove($id, $newfolder) { return true; } |
Change to:
function ImportMessageMove($id, $newfolder) { //do nothing if it is in a dummy folder if ($this->_folderid == SYNC_FOLDER_TYPE_DUMMY) return true; // See if there's a conflict $conflict = $this->isConflict("move", $this->_folderid, $id); // Update client state $change = array(); $change["id"] = $id; $change["newfolder"] = $newfolder; $this->updateState("move", $change); |
P.S. I am not the author of these information. These were all found in the z-push forums.