Pop3DownloadMessageHeader Method (Int32)
Downloads the header of the specified message from the server.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public MailMessage DownloadMessageHeader(
	int index
)

Parameters

index
Type: SystemInt32
The ordinal position of the message in the inbox. It must be in the range from 1 to InboxMessageCount. Can be negative in the range from -1 to -InboxMessageCount, i.e. -1 denotes the last e-mail in the inbox.

Return Value

Type: MailMessage
On success, a MailMessage object containing the downloaded message header; otherwise, a null reference (Nothing in Visual Basic).
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks
If more than one message header is downloaded, it's recommended to use DownloadMessageHeaders(Int32, Int32, Int32) method when possible, since it can operate much faster if the server supports pipelining.
Examples
This sample downloads header of the last message from an inbox on a POP3 server, and prints e-mail addresses of all the recipients of this message.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Mime;

// The actual code (put it into a method of your class).
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret");
MailMessage msg = pop.DownloadMessageHeader(pop.InboxMessageCount);
EmailAddressCollection recipients = msg.GetAllRecipients();
foreach (EmailAddress address in recipients)
{
    Console.WriteLine(address.Email);
}
pop.Disconnect();
See Also