OpenMessage Method  
 

Open a message on the server.

Syntax

object.OpenMessage( [MessageNumber], [MessagePart], [Offset], [Length], [Options] )

Parameters

MessageNumber
Number of message to retrieve. This value must be greater than zero. The first message in the mailbox is message number one. If this argument is omitted, the current message selected by the Message property will be opened.
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. If this argument is omitted, the complete contents of the message will be accessible.
Offset
The byte offset into the message. This parameter can be used in conjunction with the Length argument to return a specific part of a message. If this argument is omitted or a value of zero is specified, the server will return data from the beginning of the message.
Length
An optional integer value which specifies the maximum number of bytes the client wishes to read. To specify the entire message, from the offset specified by the Offset argument to the end of the message, use a value of -1. If this argument is omitted, the entire contents of the message will be returned, starting at the byte offset specified by the Offset argument. If both the Offset and Length arguments are omitted, the entire contents of the message will be returned.
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 OpenMessage method opens a message or a specific part of a multipart message in the current mailbox. The message data may also be limited a specific byte offset and length, which can be useful for previewing the contents. The client can then read the contents of the message using the Read method, and once all of the data has been read, the message should be closed by calling the CloseMessage method.

See Also

CloseMessage Method, GetMessage Method, Read Method