CImapClient::StoreMessage Method  
 
INT StoreMessage(
  UINT nMessageId,  
  LPCTSTR lpszFileName  
);

The StoreMessage method retrieves a message from the current mailbox and stores it in a local file or the system clipboard.

Parameters

nMessageId
Number of the message to retrieve. This value must be greater than zero. The first message in the mailbox is message number one.
lpszFileName
Pointer to a string which specifies the file that the message will be stored in. If an empty string or NULL pointer is passed as an argument, the message is copied to the system clipboard.

Return Value

If the method succeeds, the return value is zero. If the method fails, the return value is IMAP_ERROR. To get extended error information, call GetLastError.

Remarks

The StoreMessage method provides a method of retrieving and storing a message on the local system. The contents of the message is stored as a text file, using the specified file name. This method always causes the caller to block until the entire message has been retrieved, even if the client has been put in asynchronous mode.

If event handling is enabled, the IMAP_EVENT_PROGRESS event will fire periodically during the transfer of the message to the local system. An application can determine how much of the message has been retrieved by calling the GetTransferStatus method.

To retrieve the message into a global memory buffer so that it can be passed to the MIME or SMTP libraries, use the GetMessage method.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csmapv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also