Pop3DownloadMessageHeaders Method (Int32, Int32) |
Downloads the header of each message in the specified range from the server.
Namespace: MailBee.Pop3MailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public MailMessageCollection DownloadMessageHeaders(
int startIndex,
int count
)
Public Function DownloadMessageHeaders (
startIndex As Integer,
count As Integer
) As MailMessageCollection
Parameters
- startIndex
- Type: SystemInt32
The ordinal position (in the inbox) of the first message
in the range to be downloaded. - count
- Type: SystemInt32
Number of messages to be downloaded, or -1 to
indicate that all messages in the range startIndex to
InboxMessageCount must be downloaded.
Return Value
Type:
MailMessageCollectionOn success, a
MailMessageCollection object containing the downloaded message headers;
otherwise, a null reference (
Nothing in Visual Basic).
Exceptions Remarks
If the POP3 server supports pipelining, this method will download all the messages in a single
network operation, which greatly increases performance and reduces network traffic.
Examples This sample downloads headers of the last 10 messages in the mailbox, and displays
the following information for each message:
- Subject: field
- Date and time when the message was created
- Date and time when the message was delivered to the mailbox
The message information is displayed in descending order (from newer messages to older ones).
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Mime;
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret");
MailMessageCollection msgs = pop.DownloadMessageHeaders(pop.InboxMessageCount - 9, 10);
msgs.Reverse();
foreach (MailMessage msg in msgs)
{
Console.WriteLine("Message #" + msg.IndexOnServer + ", created at " + msg.Date + " and received at " + msg.DateReceived + ", has Subject: " + msg.Subject);
}
pop.Disconnect();
Imports MailBee
Imports MailBee.Pop3Mail
Imports MailBee.Mime
Dim pop As New Pop3
pop.Connect("mail.domain.com")
pop.Login("jdoe", "secret")
Dim msgs As MailMessageCollection = pop.DownloadMessageHeaders(pop.InboxMessageCount - 9, 10)
msgs.Reverse()
For Each msg As MailMessage In msgs
Console.WriteLine("Message #" & msg.IndexOnServer & ", created at " & msg.Date & " and received at " & msg.DateReceived & ", has Subject: " & msg.Subject)
Next
pop.Disconnect()
See Also