ImapStoreMessage Function  
 
INT WINAPI ImapStoreMessage(
  HCLIENT hClient,  
  UINT nMessageId,  
  LPCTSTR lpszFileName  
);

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

Parameters

hClient
Handle to the client session.
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 null-terminated 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 function succeeds, the return value is zero. If the function fails, the return value is IMAP_ERROR. To get extended error information, call ImapGetLastError.

Remarks

The ImapStoreMessage function 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 function 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 ImapGetTransferStatus function.

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

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csmapav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

ImapGetMessage, ImapGetMessageHeaders, ImapGetTransferStatus