public class Pop3 : Component, INetClient
Shows how to connect to a POP3 server and list recent messages.
using System; using System.Text; using ComponentPro.Net.Mail; ... // Create a new instance of the Pop3 class. Pop3 client = new Pop3(); // Connect to the server. client.Connect("myserver"); // Or you can specify the POP3 port with // client.Connect("myserver", 110); // Login to the server. client.Authenticate("user", "password"); StringBuilder sb = new StringBuilder(); Pop3MessageCollection list = client.ListMessages(Pop3EnvelopeParts.Size | Pop3EnvelopeParts.UniqueId); for (int i = 0; i < list.Count; i++) { sb.AppendFormat("{0} - {1}\r\n", i + 1, list[i].UniqueId); } Console.WriteLine(sb.ToString()); // Close the connection. client.Disconnect();