Pop3Connect Method (String, Int32)
Connects to a POP3 server.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool Connect(
	string serverName,
	int port
)

Parameters

serverName
Type: SystemString
The name or IP address of the POP3 server.
port
Type: SystemInt32
The port on which to communicate with the server. The standard POP3 port is 110. For TLS/SSL connections, dedicated port is 995 (however, TLS/SSL connections via regular port are possible too, see SslMode and StartTls topics).

Return Value

Type: Boolean
true if a connection attempt succeeded; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
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 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 filenames of all attachments.
// 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);
pop.Login("jdoe", "secret");
MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount);
foreach (Attachment attach in msg.Attachments)
{
    Console.WriteLine(attach.Filename);
}
pop.Disconnect();
See Also