Nokia E6 Symbian Anna IMAP with push mail

Nokia Symbian based phones have a terrible IMAP support. If you have IMAP server of your own, you only have two options

  • Use “Nokia Messaging” which means you receive your emails via Nokia servers (similar to blackberry) and it’d not be your phone but nokia servers which would connect to your IMAP server and push mails to your phone. This works better, but then you’re giving your details to Nokia, and could be a privacy issue for some.
  • Use the in-built IMAP client. This would mean you don’t have a ‘push’ email, but a check interval of 5 minutes. Not awesome.

Following is one more way to set to use IMAP via the Nokia Mail for Exchange client, and you don’t need to have any Microsoft Exchange setup.

 

Concept

  1. You need to be running an IMAP server.
  2. There’s an open source PHP based software called “z-push” which allows activesync connectivity and has IMAP backend, which means you can use it to ‘sync’ your phones using the Nokia Mail for Exchange client.
  3. You need Apache web server with php5 and php5-imap support where z-push would be setup.
  4. You download and configure z-push.
  5. You configure your phone settings, and then use Nokia Mfe client to connect to your IMAP server and thus have “push” functionality.

 

Assumptions

  1. An IMAP server is running with SSL support with self-signed certificates (I used dovecot), which has usernames as ‘user@domain.com‘ format.
  2. You have Apache with PHP5 and php-imap support. On ubuntu/debian you can install it using apt-get install php5-imap.
  3. Nokia Mail For Exchange supports only a single account on a phone. So if you have multiple email accounts to be synced, bad luck.
  4. It was tested on a Nokia E6 running Symbian Anna. Your setup may vary or could be different.

 

Server side setup

  1. Download z-push from Source Forge http://z-push.sf.net ; I used version z-push-1.5.4RC-705.tar.gz.
  2. Extract it in a suitable location, for example, /var/www/z-push
  3. You can refer to the INSTALL document too for more information inside the z-push extracted files.
  4. Make the ‘state’ directory web server user writable. So do chown www-data.www-data state or chmod 777 state.
  5. Configure z-push. We will modify the following
    $BACKEND_PROVIDER = "BackendIMAP";
    
    // ************************
    //  BackendIMAP settings
    // ************************
    
    define('IMAP_SERVER', 'localhost');
    define('IMAP_PORT', 993);
    define('IMAP_OPTIONS', '/ssl/novalidate-cert');
    define('IMAP_DEFAULTFROM', 'domain');
    define('IMAP_SENTFOLDER', 'Sent');
    define('IMAP_USE_IMAPMAIL', false);
  6. So that the “Sender Name” when sending out email works well, there’s a IMAP_DEFAULTFROM setting, which didn’t work too well in my case, so I modified the backend file to display the “Sender’s Name” correctly in the format Firstname Lastname <user@domain.com>. The following changes were done in backend/imap.php
    # Added the following lines in the section below
    # $v = "$this->_domain <$this->_username>";
    # $envelopefrom = "-f$this->_username";
    
                if ($k == "from") {
                    if (trim($v)) {
                        $changedfrom = true;
                        $v = "$this->_domain <$this->_username>";
                        $envelopefrom = "-f$this->_username";
                    } elseif (! trim($v) && IMAP_DEFAULTFROM) {
  7. In Apache configuration, I have SSL setup. So in the configuration file for the SSL, I specified an alias as under
            Alias /Microsoft-Server-ActiveSync "/var/www/z-push/index.php"
  8. Restart Apache and your z-push is ready.

 

Client side/phone setup

  1. Now that the server side setup is ready, we’ll configure the phone.
  2. You can enter the settings as per the requirements while configuring the Mail For Exchange client.
  3. The “domain” would be your full name (as you wish to display when you send someone an email).
  4. That’s all. Sync it and you’re ready to go!

 

Troubleshooting

  1. To enable debug logs, create a file debug.txt in the z-push directory and assign it web server user writeable privileges. For example:
    cd /var/www/z-push
    touch debug.txt
    chown www-data.www-data debug.txt # or; chmod 777 debug.txt
  2. You may want to experiment with the IMAP_OPTIONS by referring to http://php.net/imap_open
  3. Your ‘Sent’ items folder could be different. You may want to keep it blank (the default).