The OpenStore method opens a message storage file which
contains one or more messages. If the storage file is opened for read
access, the application can search the message store and extract
messages but it cannot add or delete messages. To add new messages or
delete existing messages from the store, it must be opened with write
access.
The message store is designed to be a simple, effective way to
store multiple messages together in a single file. When the message
store is opened, the contents are indexed in memory. Although there
is no specific limit to the number of messages that can be stored,
there must be sufficient memory available to build an index of each
message and its headers. If the application must store and manage a
very large number of messages, it is recommended that you use a
database rather than a flat-file message store.
Message Store Format
Each message is prefixed by a control sequence of five ASCII 01
characters followed by an ASCII 10 and ASCII 13 character. The
messages themselves are stored unmodified in their original text
format. The length of each message is calculated based on the
location of the control sequence that delimits each message, and
explicit message lengths are not stored in the file. This means that
it is safe to manually change the message contents, as long as the
message delimiters are preserved.
If the message store is compressed, the contents of the storage
file are expanded when the file is opened and then re-compressed when
the storage file is closed. Using the mimeStoreCompress option
reduces the size of the storage file and prevents the contents of the
message store from being read using a text file editor. However,
enabling compression will increase the amount of memory allocated by
the control and can increase the amount of time that it takes to open
and close the storage file.
The control also has a backwards compatibility mode where it will
recognize storage files that use the UNIX mbox format. While this
format is supported for accessing existing files, it is not
recommended that you use it when creating new message stores or
adding messages to an existing store. There are a number of different
variants on the mbox format that have been used by different Mail
Transfer Agents (MTAs) on the UNIX platform. For example, the mboxrd
variant looks identical to the mboxcl2 variant, and they are
programmatically indistinguishable from one another, but they are not
compatible. For this reason, the use of the mbox format is strongly
discouraged.