I don’t know how many of you out there have your own webserver and an iPhone, but I just found the thing I’ve been looking for ever since I got my iPhone: push e-mail!
I have a webserver running cPanel, Dovecot and suPHP. Here’s what I did:
1) Download z-push from here.
2) Upload z-push to /usr/local/apache/htdocs
3) Change ownership to nobody (it fails if you leave it as root)
4) Modify index.php (if you are using suPHP)
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) Voila! You now have push mail on your iPhone with your Dovecot IMAP server!
Update:
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 that 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 any of the above fixes. These were all found in the z-push.net forums.
Posted on January 29th, 2010