Connects to a POP3 server.
true if a connection attempt succeeded; otherwise, false.
If pipelining is true and the server supports pipelining, MailBee will join POP3 commands in batches whenever possible, providing major performance boost in scenarios when multiple messages are downloaded or deleted at once. The methods which take advantage of pipelining are: DownloadMessageHeaders, DownloadEntireMessages, DeleteMessages, and their asynchronous versions (BeginDownloadMessages, BeginDeleteMessages). The performance may increase 10+ times if many messages (20 and more) are processed.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample connects to the POP3 server, downloads headers for the first 5 messages, and displays them. If the server supports pipelining, all 5 message headers will be downloaded in a single round-trip to the server.
[C#] // 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", 110, true); pop.Login("jdoe", "secret"); MailMessageCollection msgHeaders = pop.DownloadMessageHeaders(1, 5); foreach (MailMessage msgHeader in msgHeaders) { Console.WriteLine("Message #" + msgHeader.IndexOnServer + ":\r\n" + msgHeader.RawHeader); } pop.Disconnect();
[Visual Basic] ' 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 Pop3 pop.Connect("mail.domain.com", 110, True) pop.Login("jdoe", "secret") Dim msgHeaders As MailMessageCollection msgHeaders = pop.DownloadMessageHeaders(1, 5) For Each msgHeader As MailMessage In msgHeaders Console.WriteLine("Message #" & msgHeader.IndexOnServer & ":\r\n" & msgHeader.RawHeader) Next pop.Disconnect()
Pop3 Class | MailBee.Pop3Mail Namespace | Pop3.Connect Overload List