ubuntu :: push notification with postfix and dovecot

I’ve recently setup my own mailserver, to host my own emails. I already owned a web server, so it wasn’t too big of a deal, but I did notice one small thing that was lacking. I use an iPhone and noticed that I wasn’t able to get Push notifications. This is annoying, since I don’t really ‘check’ my email. But then I stumbled across a small little package that gives me the functionality, all with minimal configuration.

It’s called d-push. And its bloody awesome.
First, you need to make sure you have your mailserver all working, I use IMAP.
Ok Lets do this.
First things’s first, install it:

sudo apt-get install d-push

Once that’s done, all you have to do is change one config file

pico /etc/d-push/config.php

Change the default port, and IMAP options

// connecting to default port (143)
 define('IMAP_PORT', 993);
 // best cross-platform compatibility (see http://php.net/imap_open for options)
 define('IMAP_OPTIONS', '/ssl/novalidate-cert');

All we’re doing here is setting it to use the IMAP port (993) and using SSL instead of un-encrypted.

What I found is that I was able to send mail, but not receive it. Upon further monitoring, my mail was coming into the server, but not going to the right MailDir directory. Had a quick look at postfix’s config and found the issue.
You may or may not need to run this..

postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
service postfix restart

That’s pretty much it.

Now when you add your email account on your iPhone, add it as an Exchange account. Fill in all the usual stuff, you may get an error (I have seen an error on one phone, but others have worked without it) just hit continue, and save.

And if all is well, you now have PUSH notifications.



  • January 17, 2016 - 10:56 pm | Permalink

    Hey Sameh,
    I ended up changing it a bit and it hasnt broken anything…yet.

    I made the imap port 143 for TLS and in imap options made it /tls based on http://php.net/imap_open

    sent and received emails with no issues so far, but still a bit of a delay on android so not sure if push is actually working?

    • sameh
      February 3, 2016 - 9:54 am | Permalink

      That’s intersting.
      I’ve tested mine in terms of a delay, and there doesn’t seem to be one. Does hit your local mailbox on time? Maybe the delay is not on the android device itself, but coming into your server and routing around the ports?

  • Leave a Reply

    Your email address will not be published. Required fields are marked *


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>