GemBox.Email is a .NET component that enables you to read, write, receive, and send emails from your .NET applications using one simple API.

List Email Messages with POP

POP servers allow clients to list currently available messages. A listing returns only basic message info like the sequence number, size and unique designator, if supported.

The example shows how to list messages using the PopClient class.

List Messages Screenshot

See the full code below.

using GemBox.Email;
using GemBox.Email.Mime;
using GemBox.Email.Pop;
using GemBox.Email.Security;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;

class Sample
    static void Main(string[] args)
        // If using Professional version, put your serial key below.

        using (PopClient pop = new PopClient("<ADDRESS> (e.g."))

            pop.Authenticate("<USERNAME>", "<PASSWORD>");

            // Get info for all available messages
            IList<PopMessageInfo> infoList = pop.ListMessages();

            Console.WriteLine("Listing messages...");

            foreach (PopMessageInfo info in infoList)
                Console.WriteLine("{0} - [{1}] - {2} Byte(s)", info.Number, info.Uid, info.Size);
Imports System.Globalization
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates
Imports GemBox.Email
Imports GemBox.Email.Mime
Imports GemBox.Email.Pop

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.

        Using pop As New PopClient("<ADDRESS> (e.g.")


            pop.Authenticate("<USERNAME>", "<PASSWORD>")

            ' Get info for all available messages
            Dim infoList As IList(Of PopMessageInfo) = pop.ListMessages()

            Console.WriteLine("Listing messages...")

            For Each info As PopMessageInfo In infoList
                Console.WriteLine("{0} - [{1}] - {2} Byte(s)", info.Number, info.Uid, info.Size)

        End Using

    End Sub

End Module

Check next sample.