Using the new class is pretty easy.
static void Main(string[] args)
{
try
{
Pop3 obj = new Pop3();
obj.Connect("mail.xxx.com", "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);
}
obj.Disconnect();
}
catch (Pop3Exception e )
{
System.Console.WriteLine(e.ToString());
}
catch (System.Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
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.
Comments