IMAP4 MTM Overview

This section provides an overview of the Internet Message Access Protocol (IMAP4) MTM.


Provides retrieval and management of email on a remote Internet Message Access Protocol (IMAP4) server.

Architectural relationships

The Messaging Middleware architecture defines a framework in which modules (MTMs) can be implemented that provide support for particular messaging protocols. A client MTM provides the API for application engines to use the protocol. The IMAP4 MTM API provides the Client MTM API, plus supporting classes for IMAP4, see Email Overview.


The API has two key concepts: IMAP4 Client MTM, and IMAP4 service settings.

IMAP4 Client MTM

The IMAP4 Client MTM provides IMAP-specific operations, the most important of which are synchronising with a remote server, or folder on a remote server. Some generic messaging operations, such as sending messages (for which you should use SMTP), are not supported by the MTM. Extra functions are provided for obtaining and setting IMAP4 service settings.

The IMAP4 Client MTM class is CImap4ClientMtm and it does not support many of the generic functions defined by the CBaseMtm base class. The IMAP4 Client MTM implements the standard Client MTM APIs and extensions for the following operations:

  • Connecting, disconnecting, synchronising, subscribing and unsubscribing folders

    These operations are accessible as commands available through the InvokeAsyncFunction class of the Client MTM. They are implemented as calls to the IMAP4 Server MTM.

  • Send on next connection

    If the Client MTM gets a request to connect to an email server, it checks for the IMAP4 settings. . If the send on next connection option is set, the Client MTM launches the autosend.exe executable that handles sending messages waiting in the outbox.

  • Reply to and forward messages

    These are accessible through the ReplyL() and ForwardL() classes of a Client MTM and are implemented as calls to the email utilities CImEmailOperation class.

  • Reply to, forward, create new, create receipt and forward as attachment

    These are accessible as commands available through the InvokeAsyncFunction class of the Client MTM. They are implemented as calls to CImEmailOperation.

  • Querying connection status

    These commands let clients know whether the IMAP4 Server MTM is connected to an email server and whether it is currently processing a request. They are available through the InvokeAsyncFunction class of the Client MTM. The Client MTM requests the information from the Server MTM.

  • Compound connection and synchronisation

    The IMAP4 Client MTM provides a compound operation that connects and synchronises with an IMAP4 server. This operation is implemented as a client-side object that combines requests to the IMAP4 Server MTM. The client-side operation can complete the client request either: after the connection; after the connection and synchronisation; or after the connection, synchronisation, and disconnection. The client keeps requesting that the inbox be resynchronised at a configurable interval so new messages received in the inbox on the server appears under the IMAP4 inbox. The CImapConnectAndSyncOp class handles these compound operations.

  • Compound connect and copy, move or populate messages

    The IMAP4 Client MTM provides a compound operation that connects to an IMAP4 server and copies, moves, or populates messages. The implementation is provided by the CImImap4GetMail class which makes callbacks into the IMAP4 Client MTM.

  • Offline operations

    The IMAP4 Client MTM has a command to cancel offline operations. This is available through the InvokeAsyncFunction API of the Client MTM. The Client MTM passes the request to the Server MTM.

IMAP4 service settings

Settings for a service are associated with a service-type entry in the Message Server's Message Store. IMAP service settings, such as the user name and password, synchronisation strategy, and the maximum number of messages to synchronise are specified in this object. This is used by many IMAP components.

The settings are loaded when a connection is made to the server. However, the settings are not actually stored in the message store, but in the device's Central Repository data store.

Encapsulation of service settings is provided by the CImImap4Settings class.

Get mail helper

The helper wraps up many individual IMAP operations into a single call. A large number of options are available, which fall into the following groups:

  • get mail when already connected

  • connect, get mail and then disconnect

  • connect, get mail and then stay online

The get mail helper class is CImImap4GetMail.

Related reference
Email Settings