SocketTools .NET Edition

PopClient.GetHeaders Method (Byte[], Int32)

Retrieves the headers for the current message from the server.

[Visual Basic]
Overloads Public Function GetHeaders( _
   ByVal buffer As Byte(), _
   ByRef length As Integer _
) As Boolean
[C#]
public bool GetHeaders(
   byte[] buffer,
   ref int length
);

Parameters

buffer
A byte array that will contain the message data when the method returns.
length
An integer value which specifies the maximum number of bytes of data to write. This value cannot be larger than the size of the buffer specified by the caller.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The GetHeaders method is used to retrieve the message headers from the server and copy it into a local buffer. This method will cause the current thread to block until the article 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.

Note that the header data will be from the first part of the message, not from any additional sections of a multipart message. In other words, the headers such as From, To, Subject and Date will be returned in the buffer. To retrieve the headers from a specific section of a multipart message, you can use the GetMessage method and specify the ImapSections.sectionHeader option.

The current message number is specified by the value of the Message property.

See Also