Use SSL with POP3

Ultimate Mail POP3 Library supports Secure Socket Layer (SSL) and Transport Layer Security (TLS) protocols to establish secure connections between the clients and POP3 servers. People usually say SSL. But in fact, they mean TLS. SSL v3 is the newest version introduced in 1996, while TLS was first introduced in 1999 and its latest version is v1.2 released in 2008.

There are two modes in which ComponentPro.Mail.dll can work:

Implicit – where a POP3 client use a secure channel to immediately establish a connection to the server. The client connects, the SSL handshake occurs, and if successful the secure communication continues for the session. With implicit SSL, the POP3 server specifies a dedicated port for the secure connections from clients. By doing so, the connections require less overhead.

Explicit – where it establishes a normal connection to the server, usually on the standard POP3 110 port. Then it issues STARTTLS command to switch to SSL mode. The server will response to that command, the negotiation is clear and then the establish an SSL session. The connection is only securely upgraded when the server supports the mechanism and response properly. From here the communication between the client and server is secured until it's downgraded.

In both cases, by default, SSL 3.0 and TLS 1.0, 1.1 & 1.2 are acceptable for secure communication. You can change the defaults using Config property of the Pop3 class.

POP3 Implicit SSL mode

In order to connect to a mail server using Implicit SSL mode, it's advised to know in advance whether the server supports Implicit SSL. Typically, port 995 is dedicated for POP3 Implicit SSL connections. However if it's not the case, the Connect method overloads also accept custom ports other than 995.

Imports System.Text
Imports ComponentPro.Net
Imports ComponentPro.Net.Mail
...
' Create a new instance of the Pop3 class.
Dim client As New Pop3()
' Connect to the server.
client.Connect("myserver", 993, SslSecurityMode.Implicit)
' Login to the server.
client.Authenticate("user", "password")
Dim sb As New StringBuilder()
Dim list As Pop3MessageCollection = client.ListMessages(Pop3EnvelopeParts.Size Or Pop3EnvelopeParts.UniqueId)
For i As Integer = 0 To list.Count - 1
sb.AppendFormat("{0} - {1}" & vbCrLf, i + 1, list(i).UniqueId)
Next i
Console.WriteLine(sb.ToString())
' Close the connection.
client.Disconnect()

POP3 Explicit SSL mode

The library connects using clear text channel and issues STARTTLS command to secure the channel. The standard POP3 port 110 or 587 is usually used for Explicit SSL mode. But if you need to specify a different port, you can pass the custom port number to the Connect method overloads.