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:
- Mailbox in use. This specifies which mailbox's Outgoing
e-mail settings will be used when sending an email from
somewhere other than the Messaging application. For example,
if you are in the Gallery and do a Send...Via e-mail, the server
specified in the Mailbox in use setting will be used. When you
are composing an email in the Messaging application, the outgoing mail
server for that mailbox will be used, not the one specified
in Mailbox in use.
- New e-mail alerts. This specifies whether or not you'll get an
audio alert and the
New e-mail
dialog box on the Standby
screen when a new email arrives. It does not affect the @
indication on the Standby screen, nor does it affect push
behavior.
- E-mail notifications.
This option enables
Open Mobile Alliance Email Notification
(OMA EMN).
OMA EMN uses WAP Push to notify the phone of a new email without having an
active data connection. OMA EMN requires server-side support to send
the WAP Push message.
This option has no effect when using IMAP IDLE. Whether
this option is enabled or disabled, the S60 email client provides
immediate notification of new emails when connected to the server that
supports IMAP IDLE.
This setting is only available on FP1 and later phones.
- E-mail retrieval. If this option is
enabled, the S60 email client will connect to the mailbox when the
phone starts, and will continue running in the background so that it
can't accidentally be exited. This setting was called "Header
retrieval" on pre-FP1 phones.
- When the Retrieval interval is set to 5, 15, or 30
minutes, the email client will remain connected to the mailbox, and
perform an IDLE. However, it does not behave the same way as when
this option is disabled. When a new email comes in, the email client
will retrieve it, but it may choose not to give a notification.
It's not entirely clear how this feature works (it may be a bug), but
emails that arrive closer together than the Retrieval interval
don't always appear until the next email arrives. I think the intent
was that a setting of 5 minutes means,
I don't want to be notified of
new emails more often than once every five minutes,
but that isn't
quite how it works. This option also causes the email client to
reconnect to the server if it is disconnected.
Other than the time it would take until a reconnection if the server
closed the connection, there is no functional difference between the
5, 15, and 30 minute settings when IDLE is being used. The email
client will never poll the server for new email when an IDLE is
active.
- When the Retrieval interval is set to 2, 4, or 6 hours, the
email client connects at the specified frequency, but it disconnects after
checking for new email. An IDLE is not performed, so there is no
immediate notification of new email.
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)