Pop3Connect Method (String) |
Connects to a POP3 server on the standard POP3 port (110).
Namespace: MailBee.Pop3MailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public bool Connect(
string serverName
)
Public Function Connect (
serverName As String
) As Boolean
Parameters
- serverName
- Type: SystemString
The name or IP address of the POP3 server.
Return Value
Type:
Booleantrue if a connection attempt succeeded; otherwise,
false.
Exceptions Remarks If
Pipelining is
true and the server supports pipelining,
MailBee will use it and join POP3 commands in batches whenever possible (see
Connect(String, Int32, Boolean) overload for more information).
Note |
---|
By default, MailBee can autodetect if the mail server you're connecting to requires SSL connection (this works for
well-known mail services like gmail.com or live.com). To disable SSL mode and port autodetection,
set AutodetectPortAndSslMode to false. |
Examples This sample connects to the POP3 server, downloads the last message entirely,
and displays its body text. If the message is HTML formatted, plain-text version is displayed.
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Mime;
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret");
MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount);
Console.WriteLine(msg.BodyPlainText);
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 msg As MailMessage
msg = pop.DownloadEntireMessage(pop.InboxMessageCount)
Console.WriteLine(msg.BodyPlainText)
pop.Disconnect()
See Also