Push Email with the S60 Email Client

The built-in S60 email client on phones such as the N95 can provide something very close to push email without installing any additional software. By using the IDLE feature of the IMAP email protocol, the S60 email client can provide notification of new emails within seconds of their arrival in your inbox.

If an IMAP server and client both support the IDLE feature, the server will push a new email notification to the client immediately. This notification allows the client to retrieve the email and notify the user. The contents of the email itself is not pushed, only a notification is. It is the client's responsibility to act on the push notification.

IMAP IDLE requires a continuous data connection to the server in order to receive immediate new email notifications. As such, it is sometimes not considered true push; other push systems don't require a data connection for new email notification, but use another channel such as SMS.

To configure push email on an S60 device, simply configure your incoming mailbox type as IMAP4. If your mail server supports IDLE, the S60 client will use it automatically, and you will get immediate email notifications. It is not necessary to configure the Automatic retrieval settings; even the E-mail notifications setting can be left at its default value of disabled. To maintain the connection to your email service, do not exit the Messaging application. Just press the menu button or use the task switcher to return to the Standby screen. If you attempt to exit, you will be warned that you are about to disconnect the active mailbox. If you do exit, you will not get email notifications until you connect again.

S60 Email Client Settings

Some of the settings for the S60 email client are poorly documented, if at all. I've done some testing to figure out exactly what some of them do:

Determining Whether Your IMAP Server Supports IDLE

If your IMAP server has security enabled, as most do, you'll need the OpenSSL command line client to do this test. This example shows how to check the Gmail server. Responses from the server are in bold:
openssl s_client -crlf -connect imap.gmail.com:993
* OK Gimap ready for requests from XXX.XXX.XXX.XXX g11if1009384gve.0
1 CAPABILITY
* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA XLIST CHILDREN XYZZY
1 OK Thats all she wrote! g11if1009384gve.0
2 LOGOUT
* BYE Logout Requested g11if1009384gve.0
2 OK Quoth the raven, nevermore... g11if1009384gve.0
We know that Gmail supports IDLE, since IDLE appears on the CAPABILITY response from the server.

Gmail IMAP

Gmail's IMAP servers support IDLE and work with the S60 email client. However, my testing (April, 2008) shows that the Gmail IMAP servers often disconnect after IDLEing for as little as 15-20 minutes. This problem was confirmed on a desktop machine with a wired Internet connection, so it is not an issue with the S60 email client. The IMAP protocol does not permit an inactivity timeout of less than 30 minutes, so this behavior is violating the RFC. The S60 email client will not automatically reconnect after such a disconnect, unless E-mail retrieval is enabled. There's no notification that this disconnection has occurred if E-mail retrieval is disabled.
Copyright © 2008 John Temples (s60 at xargs dot com)