The IMAP IDLE extension to the IMAP specification, defined in RFC 2177, allows an IMAP server to notify the mail client when new messages arrive and other updates take place in a user's mailbox. The IMAP IDLE feature has the following benefits:
Mail clients do not have to poll the IMAP server for incoming messages.
Eliminating client polling reduces the workload on the IMAP server and enhances the server's performance. Client polling is most wasteful when a user receives few or no messages; the client continues to poll at the configured interval, typically every 5 or 10 minutes.
A mail client displays a new message to the user much closer to the actual time it arrives in the user's mailbox. A change in message status is also displayed in near-realtime.
The IMAP server does not have to wait for the next IMAP polling message before it can notify the client of a new or updated mail message. Instead, the IMAP server receives a notification as soon as a new message arrives or a message changes status. The server then notifies the client through the IMAP protocol.
The IMAP IDLE feature relies on the Event Notification Service (ENS) to propagate notifications. To use IMAP IDLE, you must configure the following ENS components:
An enpd server on at least one host
The iBiff notification plug-in on all message store hosts
For information on configuring ENS for Messaging Server, see the Sun Java System Communications Services Event Notification Service Guide.
For information on configuring the iBiff notification plug-in, see B.1 Loading the ENS Publisher in Messaging Server.
Configure the enpd server to accept connections only from the hosts running the message stores.
To restrict connections to message-store hosts, set the ENS_ACCESS environment variable. The environment variable sets a list of permissions allowing access to enpd. The syntax is as follows:
setenv ENS_ACCESS 'allowdeny ipaddress|mask; allowdeny ipaddress|mask; ...' |
where
Can be either + (to specify allow) or — (to specify deny)
Specifies a dotted-decimal IP address
Specifies a dotted-decimal IP address mask
Examples:
The following example allows access to the local host only:
setenv ENS_ACCESS '+127.0.0.1|255.255.255.255' |
The following example allows access to the local host and all IP addresses 192.168.0.* except 192.168.0.17:
setenv ENS_ACCESS '+192.168.0.1|255.255.255.0;+127.0.0.1|255.255.255.255; \ -192.168.0.17;255.255.255.255' |
Run the configutil utility to specify the name of the host where the ENS server is running.
cd msg-svr-base ./configutil -o local.store.notifyplugin.enshost -v "ipaddress" |
where ipaddress specifies a dotted-decimal IP address of the ENS host machine.
Example:
cd msg-svr-base ./configutil -o local.store.notifyplugin.enshost -v "127.0.0.1" |
Specify the event key to use for notifications.
If the ENS event key (ensEventKey) is set to its default value, IMAP IDLE does not operate.
You must configure the ensEventKey value to end with %M. The string %M is a substitution code that is replaced by the name of the mailbox in which the event occurred.
Run the following configutil command:
./configutil -o local.store.notifyplugin.enseventkey -v "eventkey" |
where eventkey is a unique identifier used by ENS. Its default value is enp://127.0.0.1/store. The host-name portion of the event key is not used to determine the host where ENS is running; it is simply part of the identifier.
Example:
./configutil -o local.store.notifyplugin.enseventkey -v "enp://127.0.0.1/store/%M" |
Load the libibiff notification plug-in file, which enables the ENS publisher for Messaging Server.
Run the following configutil command:
./configutil -o local.store.notifyplugin -v "msg-svr-base/lib/libibiff" |
Enable notifications to be sent from all user mailboxes, not only the inbox.
By default, notifications are generated only by events that occur in the inbox. However, the IMAP IDLE RFC (2177) specifies that IDLE must notify clients whenever an event occurs in any mailbox.
To comply with the RFC, the IMAP IDLE feature requires that notifications be enabled for all mailboxes. If they are not, the IMAP server will not advertise the IDLE capability.
To configure notifications for all mailboxes, set the configutil command, noneinbox, to a value of 1:
./configutil -o local.store.notifyplugin.noneinbox.enable -v 1 |
where -v 1 enables notifications from all mailboxes.
Stop, then restart Messaging Server.
cd msg-svr-base/sbin ./stop-msg ./start-msg |
Verify that the IMAP services now include the IDLE feature. Use telnet to connect to the IMAP host and port.
telnet IMAP_hostname port |
Example:
telnet myhost imap trying 192.18.01.44 ... connected to myhost.siroe.com * OK [CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ NAMESPACE UIDPLUS CHILDREN BINARY UNSELECT SORT LANGUAGE STARTTLS IDLE XSENDER X-NETSCAPE XSERVERINFO X-SUN-SORT X-SUN-IMAP X-ANNOTATEMORE AUTH=PLAIN] myhost.siroe.com IMAP4 service (Sun Java(tm) System Messaging Server 6.3-0.05 (built Feb 7 2006)) |