SocketTools Message Store

SocketTools includes components for sending e-mail using SMTP, downloading and managing messages using POP3 or IMAP4 and a general purpose MIME component that can be used to parse messages and create new ones. However, one of the problems that developers often face is what to actually do with those messages once they have been sent or received. SocketTools has introduced a set of extensions to the Mail Message component that makes it easy to store, search and retrieve messages on the local system.

If you are using the Library Edition, the new functions are part of the Mail Message (MIME) API and use a new type named HMESSAGESTORE to manage the stored messages. For example, to open or create a new message store file, you would use the MimeOpenMessageStore function. To retrieve a message, you would call MimeGetStoredMessage and to save a message, you’d use the MimeStoreMessage function. If you are using the ActiveX control or .NET component, then the same functionality is available with the OpenStore, ReadStore and WriteStore methods.

The format that we use for storing the messages is a simple flat file with each message delimited by a sequence of control characters (for those of you who are familiar with the MMDF mail software, the format is similar to what it used for its mailboxes). We intentionally wanted to make it easy to view the contents of the storage file, and even modify it externally. However, for large message stores you can specify an option that will compress the contents and since it’s primarily text, the compression rates are typically very high. For developers who are also working with UNIX based systems, the message store API is also capable of importing messages from several standard mbox formats.

We wanted to provide developers an easy way to store e-mail messages, without concern about being locked into a complex, proprietary format or writing a lot of additional code. By integrating the message store API directly within the MIME components, adding this functionality is simple and requires only a few additional lines of code in an existing application.

Share This
Facebooktwittergoogle_plus