|Pop3DownloadMessageHeader Method (Int32, Int32)|
public MailMessage DownloadMessageHeader( int index, int bodyLineCount )
Public Function DownloadMessageHeader ( index As Integer, bodyLineCount As Integer ) As MailMessage
When bodyLineCount is 0, only the message header is downloaded. When bodyLineCount is -1, this method is equivalent to DownloadEntireMessage(Int32) method.
Setting bodyLineCount to a positive value allows the developer to implement message body preview feature. In this case, it's recommended to set bodyLineCount >= 20 since the first 5-15 lines of the message source body are often filled with the special information and do not contain the actual body text.
If bodyLineCount is set to a certain value (such as 100), small messages having less than 100 lines in the message source body will be downloaded completely. Larger messages will be parsed partially. For instance, if 100 body lines of the message have been received, and the message contains an attachment which starts at 80-th line and ends at 150-th line of the message source body (so it has not fitted in the 100 lines received), MailBee will still add this attachment into Attachments collection, but the attachment binary data will obviously be incomplete.
|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.|
// 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, 20); Console.WriteLine(msg.BodyPlainText); pop.Disconnect();
' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.Pop3Mail Imports MailBee.Mime ' The actual code (put it into a method of your class). Dim pop As New Pop3 pop.Connect("mail.domain.com") pop.Login("jdoe", "secret") Dim msg As MailMessage msg = pop.DownloadMessageHeader(pop.InboxMessageCount, 20) Console.WriteLine(msg.BodyPlainText) pop.Disconnect()