Open a MailFolder

The following example demonstrates using aspNetIMAP to open the "Inbox" folder and write out various information about it.

[C#]

//create an IMAP4 object
IMAP4 imap = new IMAP4( "127.0.0.1" );

imap.Login("dave@blah.com", "test" );

//open the inbox, and write out basic information
MailFolder mf = imap.OpenFolder( "inbox" );       

Console.WriteLine( mf.Information().ToString() );

//write out the log, the username and password will be masked
Console.WriteLine( imap.Logger.ToString() );

imap.Disconnect();

Console.WriteLine( "Done" );
Console.ReadLine();

 

[VB.NET]

 'create an IMAP4 object
Dim imap As New IMAP4("127.0.0.1")

imap.Login("dave@blah.com", "test")

'open the inbox, and write out basic information
Dim mf As MailFolder = imap.OpenFolder("inbox")

Console.WriteLine(mf.Information().ToString())

'write out the log, the username and password will be masked
Console.WriteLine(imap.Logger.ToString())

imap.Disconnect()

Console.WriteLine("Done")
Console.ReadLine()