Email Overview

The Email collection provides support for sending and receiving emails using the individual email protocols, such as IMAP4, POP3 and SMTP, and also has support for parsing and generating plain and rich text, MIME and M-HTML format emails.


The Email collection consists of a set of utilities and MTMs for the POP3, IMAP4 and SMTP messaging protocols.

Figure 1. Email architecture

Autosend is an executable file that is executed by the POP3 and IMAP4 client MTMs if the send on next connection setting is set. This executable makes a request to the SMTP server MTM to send messages associated with the SMTP service related to the POP3 or IMAP4 service, wait for the operation to finish and then exit.

Server MTM

A Server MTM provides specific message type storage and transport. It interacts with the Message Server to store and manage entries and provide a transport mechanism.

Email client MTMs

Email client MTMs provide client-side APIs (IMCM DLL) for IMAP4, POP3 and SMTP.

The email client MTMs are used directly by clients to access parts of email messages for display. The CImEmailMessage class provides the functionality used by clients to display email messages, including listing attachments, getting body text and resolving URIs in M-HTML messages.

Email client utilities

The email client MTM uses the email client utilities when they are requested to create, reply to and forward messages. The CImEmailOperation class provides the functionality to perform these operations. Each email is represented by a parent message entry with child entries that represent MIME folders and MIME parts. Adding or deleting MIME parts involves navigating the tree of entries and inserting or removing entries as appropriate.

Email server utilities

Email server utilities are responsible for generating and parsing of RFC2822 format email messages and providing an API to wrap up a TCP/IP connection to a remote email server.


Email messages are represented in a common format whether they are being sent by SMTP and downloaded by POP3 or IMAP4. Messaging clients can use the email client MTMs to create and compose email messages with attachments and a vCard signature. They can reply to or forward email messages. When connecting to a POP3 mailbox, just the header can be downloaded, or the entire message including attachments. However, when connecting to an IMAP4 mailbox, any or all of the following can be downloaded:

  • the header

  • the header and body text

  • the entire message including attachments

  • partial body text where the body text size limit is specified

  • download attachments if the attachment size is less then or equal to attachment size limit

Messaging clients can access any part of the message for display to the user. Messages can be moved or copied within folders on the local device and, for IMAP4 only, within the mailbox as well.

Email client MTMs provide APIs that allow configuration information, such as secure or non-secure TCP/IP connection, username, password and message limits to be stored on the local device. Email client MTMs can be commanded to stay online during a client session, or connect and disconnect only when necessary. Operations such as moving, deleting, or sending a message while not connected can be queued for execution when the next connection to the subscriber's mailbox is established.

Note: Email client MTMs are not responsible for any graphical or user interface associated functionality, such as rendering HTML or images, although they do provide access to images and HTML downloaded to the local device.

For each email account a pair of services entries is created in the Message Store. For a POP3 account there will be an SMTP service and a POP3 service. For an IMAP4 account there will be an SMTP service and an IMAP4 service. These entries are used to store the settings for the email transport. Each of the service entry has its related ID that is set to the other member of the pair. The SMTP service is invisible, so that the user only sees the POP3 or IMAP4 service entry. Copying a message to the SMTP service causes the SMTP server MTM to attempt to send the message. The POP3 and IMAP4 MTMs provide functionality to synchronise with a remote email server by using the client MTM interface through the InvokeAsync API.

Figure 2. Email operation sequence diagram


The Email collection constitutes the following components:

Using Email

Email client applications can use the following functionality provided by the Email collection to:

  • Store emails including MIME headers, RFC2822 headers, attachments, body text and encoding information in the Message Store.

  • Manipulate email messages, for example, adding attachments and replying.

  • Encapsulate the character converters, which are used to convert between standard character sets and Unicode.

  • Store email settings in the central repository.

  • Get progress information for email operations.