Storing Messages in SQL Database

This document explains how to define the header structure of messages before storing them in the SQL database and lists the advantages of doing so.

Header structure

The header structure of messages is specific to each Message Type Module (MTM). The Messaging framework provides a generic interface to store and access the header information.

MTM developers use the CMsvHeaderStore API to create a specific header table and specify their message header structure to the Message Server.

The CMsvHeaderStore::CreateStoreL() function creates a header table. Before creating a header table for your MTM, you should check whether the table already exists, by calling the DoesStoreExistsL() function.

TCommonHeaderField is the enumeration defining the following standard message header fields:

  • EFrom – ‘From’ field of the message header

  • EBCC – ‘BCC’ field of the message header

  • ETo – ‘To’ field of the message header

  • ECC – ‘CC’ field of the message header.

  • ESubject – ‘Subject’ field of the message header.

To add specific fields to the header table, call the AddFieldL() function.

CEmailAccounts is the API provided by the email client MTM. This class creates, loads, saves and deletes email accounts. When creating the email account, the client MTM has to provide the header structure through the CMsvHeaderStore API to pass to the Messaging framework. The framework will then create the header for the account.

Advantages of SQL message storage

The message headers are stored in an SQL database, which provides the following advantages:

  • robustness of mail storage

  • quick processing of the frequently-required header data

  • support for search-sort operations

  • increased performance of the Message Server.

Related concepts