Home | Contact Us | Download | Support | Purchase | Shopping Cart | Products


Product List
  "Thank you so much you are a true life saver and your software is fantastic. We will be purchasing a full copy asap. You are a true miracle worker. Thanks"
C. Lucas
File Direct
 
More
Testimonials

Connecting to a POP3 Server

This example connects to a POP3 server and retrieves the number of messages at the server, and the size of the inbox.  This example also demonstrates the logging capabilities of aspNetPOP3.

[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 );
           
           
            //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)

    
    'Close the POP3 Connection
    pop.Disconnect()
            

 

 

 

 



The box is not shipped. aspNetPOP3 is a downloadable product.