GetMessage Method  
 

Retrieve a message from the server.

Syntax

object.GetMessage( MessageNumber, MessagePart, MessageData, [Options] )

Parameters

MessageNumber
Number of message to retrieve from the server. This value must be greater than zero. The first message in the mailbox is message number one.
MessagePart
The message part that will be retrieved. A value of zero specifies that the complete message should be returned. If the message is a multipart MIME message, message parts start with a value of one.
MessageData
A string or byte array which will contain the data transferred from the server when the method returns.
Options
An optional integer value which specifies one or more options. This argument is constructed by using a bitwise operator with any of the following values:
Value Constant Description
0 imapSectionDefault All headers and the complete body of the specified message or message part are to be retrieved. The client application is responsible for parsing the header block. If the message is a MIME multipart message and the complete message is returned, the application is responsible for parsing the individual message parts if necessary.
1 imapSectionHeader All headers for the specified message or message part are to be retrieved. The client application is responsible for parsing the header block.
2 imapSectionMimeHeader The MIME headers for the specified message or message are to be retrieved. Only those header fields which are used in MIME messages, such as Content-Type will be returned to the client. This is typically useful when processing the header for a multipart message which contains file attachments. The client application is responsible for parsing the header block.
4 imapSectionBody The body of the specified message or message part is to be retrieved. For a MIME formatted message, this may include data that is uuencoded or base64 encoded. The application is responsible for decoding this data.
4096 imapSectionPreview The message header or body is being previewed and should not be marked as read by the server. This prevents the message from having the imapFlagSeen flag from being automatically set when the message data is retrieved.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The GetMessage method is used to retrieve a message from the server and copy it into a local buffer. This method will cause the current thread to block until the message transfer completes, a timeout occurs or the transfer is canceled. During the transfer, the OnProgress event will fire periodically, enabling the application to update any user interface objects such as a progress bar.

See Also

CopyMessage Method, CreateMessage Method, DeleteMessage Method, OpenMessage Method, OnProgress Event