LONG StoreMessage( |
|
CMailMessage& mailMessage |
|
); |
LONG StoreMessage( |
|
HMESSAGE hMessage |
|
); |
The StoreMessage method stores the specified message in the
current message store.
Parameters
- hStorage
- Handle to the message store.
- mailMessage
- A CMailMessage object which references the message that
will be stored.
- hMessage
- Handle to the message that will be stored.
Return Value
If the method succeeds, the return value is the message number for
the message that was just stored. If the method fails, the return
value is MIME_ERROR. To get extended error information, call
GetLastError.
Remarks
The StoreMessage method 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 DeleteMessage method to mark
the original message for deletion and then use StoreMessage to
write the updated message to the message store.
Example
CMailMessage mailMessage;
// Compose a new message
mailMessage.ComposeMessage(lpszSender,
lpszRecipient,
NULL,
lpszSubject,
lpszMessage,
NULL,
MIME_CHARSET_DEFAULT,
MIME_ENCODING_DEFAULT);
CMessageStore mailStorage;
// Open the message storage file
if (mailStorage.OpenFile(lpszFileName, MIME_STORAGE_WRITE))
{
// Store a copy of the message in the message store
nMessageId = mailStorage.StoreMessage(mailMessage);
if (nMessageId == MIME_ERROR)
{
// We were unable to store the message
}
// Close the message store
mailStorage.CloseFile();
}
Requirements
Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csmsgv10.lib
See Also
DeleteMessage,
FindMessage,
GetMessage
|