MimeStoreMessage
LONG MimeStoreMessage(
HMESSAGESTORE hStorage,  
HMESSAGE hMessage,  
DWORD dwReserved  
);

The MimeStoreMessage function stores the specified message in a message store.

Parameters

hStorage
Handle to the message store.
hMessage
Handle to the message that will be stored.
dwReserved
A reserved parameter. This value must always be zero.

Remarks

The MimeStoreMessage function will always append the specified message to the storage file. If you want to replace a message in the message store, you should use the MimeReplaceStoredMessage function.

Return Value

If the function succeeds, the return value is the message number for the message that was just stored. If the function fails, the return value is MIME_ERROR. To get extended error information, call MimeGetLastError.

Example

HMESSAGE hMessage;

// Compose a new message
hMessage = MimeComposeMessage(lpszSender,
                              lpszRecipient,
                              NULL,
                              lpszSubject,
                              lpszMessage,
                              NULL,
                              MIME_CHARSET_DEFAULT,
                              MIME_ENCODING_DEFAULT);

if (hMessage != INVALID_MESSAGE)
{
    HMESSAGESTORE hStorage;

    // Open the message storage file
    hStorage = MimeOpenMessageStore(lpszFileName, MIME_STORAGE_WRITE);

    if (hStorage == INVALID_MESSAGESTORE)
    {
        // Delete the message and return if we are unable to
        // open the storage file
        MimeDeleteMessage(hMessage);
        return;
    }

    // Store a copy of the message in the message store
    nMessageId = MimeStoreMessage(hStorage, hMessage, 0);

    if (nMessageId == MIME_ERROR)
    {
        // We were unable to store the message
    }

    // Close the message store
    MimeCloseMessageStore(hStorage);

    // Destroy the message that was created
    MimeDeleteMessage(hMessage);
}

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csmsgav6.lib.

See Also

 MimeDeleteStoredMessage, MimeFindStoredMessage, MimeGetStoredMessage, MimeReplaceStoredMessage


Copyright © 2008 Catalyst Development Corporation. All rights reserved.