POP3 Client in C# and VB.NET

The Post Office Protocol (POP) was the first widely used protocol for receiving mail messages.

GemBox.Email enables you to work with the POP protocol in C# and VB.NET using a PopClient class. It supports the latest version (version 3; POP3) defined in RFC 1939. To learn about how to receive an email and how to connect with some common POP3 servers (like Gmail, Outlook, Yahoo, etc.), visit our Receive example.

The following example shows how you can create a new PopClient and use it to connect to, authenticate and disconnect from a remote POP3 server.

Using a POP3 client in C# and VB.NET
Screenshot of PopClient's output
using System;
using GemBox.Email;
using GemBox.Email.Pop;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // Create new POP client.
        using (var pop = new PopClient("<ADDRESS> (e.g. pop.gmail.com)"))
        {
            // By default the connect timeout is 5 sec.
            pop.ConnectTimeout = TimeSpan.FromSeconds(4);

            // Connect to POP server.
            pop.Connect();
            Console.WriteLine("Connected.");

            // Authenticate using the credentials; username and password.
            pop.Authenticate("<USERNAME>", "<PASSWORD>");
            Console.WriteLine("Authenticated.");
        }

        Console.WriteLine("Disconnected.");
    }
}
Imports System
Imports GemBox.Email
Imports GemBox.Email.Pop

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        ' Create new POP client.
        Using pop As New PopClient("<ADDRESS> (e.g. pop.gmail.com)")

            ' By default the connect timeout is 5 sec.
            pop.ConnectTimeout = TimeSpan.FromSeconds(4)

            ' Connect to POP server.
            pop.Connect()
            Console.WriteLine("Connected.")

            ' Authenticate using the credentials; username and password.
            pop.Authenticate("<USERNAME>", "<PASSWORD>")
            Console.WriteLine("Authenticated.")
        End Using

        Console.WriteLine("Disconnected.")
    End Sub
End Module

Even though POP protocol has largely been made obsolete by newer IMAP protocol, it's still widely used for simple email operations.

You can reuse the same connection that's established by the PopClient object and your email server multiple times.

When calling the PopClient.Authenticate method, the strongest possible password-based authentication mechanism will be used from the PopClient.SupportedAuthentications collection.

To disconnect from the email server, you can use either the PopClient.Disconnect or PopClient.Dispose method.

Last, PopClient utilizes the following protocol's extensions:

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.


Like it?

Download Buy

If you want to try the GemBox.Email yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.