Download a Message as Text
The following example downloads a POP3 message as text.

[C#]

POP3 pop = new POP3( "127.0.0.1", "dave@blah.com", "mypassword"); //if we have write permissions we can log the session pop.LogPath = "c:\\aspNetPOP3.log"; pop.LogOverwrite = true; //if we don't have write permissions (as in an ASP.NET application, we can maintain the log in memory) pop.LogInMemory = true; //connect to the POP3 server pop.Connect(); //get the number of messages and the size of the inbox pop.PopulateInboxStats(); Console.WriteLine( "There are {0} messages waiting.", pop.InboxMessageCount ); Console.WriteLine( "The total inbox size is {0} bytes.", pop.InboxSize ); //get the first message string text = pop.GetMessageAsText( 0 ); //show the message Console.WriteLine( text ); //Close the POP3 Connection pop.Disconnect(); //display the log Console.WriteLine( "Log----"); Console.WriteLine( pop.Log );


[VB.NET]

Dim pop As New POP3("127.0.0.1", "dave@blah.com", "mypassword") 'if we have write permissions we can log the session pop.LogPath = "c:\aspNetPOP3.log" pop.LogOverwrite = True 'if we don't have write permissions (as in an ASP.NET application, we can maintain the log in memory) pop.LogInMemory = True 'connect to the POP3 server pop.Connect() 'get the number of messages and the size of the inbox pop.PopulateInboxStats() Console.WriteLine("There are {0} messages waiting.", pop.InboxMessageCount) Console.WriteLine("The total inbox size is {0} bytes.", pop.InboxSize) 'get the first message Dim emailText As String = pop.GetMessageAsText(0) 'show the message Console.WriteLine(emailText) 'Close the POP3 Connection pop.Disconnect()