How to POP3 in C#

Using the Class

Using the new class is pretty easy.

static void Main(string[] args)
        Pop3 obj = new Pop3();
        obj.Connect("", "yyy", "zzz");
        ArrayList list = obj.List();
        foreach (Pop3Message msg in list )
            Pop3Message msg2 = obj.Retrieve(msg);
            System.Console.WriteLine("Message {0}: {1}",
                msg2.number, msg2.message);
    catch (Pop3Exception e )
    catch (System.Exception e)

Instantiate a new object, then call the List method. The List method will return an array of Pop3Message objects. You can then iterate through the Pop3Message objects and retrieve each in turn. Finally, you call the Disconnect method to release the socket. POP3 is described in RFC 1939. You can read the full specification from the IETF website.

You might also like...


About the author

Randy Charles Morin

Randy Charles Morin Canada

Randy's article are Copyright 1998-2003 Randy Charles Morin

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone” - Bjarne Stroustrup