Create a Folder

The following example demonstrates using aspNetIMAP to create a MailFolder on the IMAP server.

[C#]

 IMAP4 imap = new IMAP4( "127.0.0.1" );
  
 imap.Logger = new IMAPLog();
 imap.Logger.InMemory = true;
  
 imap.Logger.Path = "C:\\imap.log";
  
 imap.Username = "dave@blah.com";
 imap.Password = "test";
 imap.Login();
  
 //create a new folder
 imap.CreateFolder( "NewFolder" );
  
 //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]

Dim imap As New IMAP4("127.0.0.1")
 
imap.Logger = New IMAPLog()
imap.Logger.InMemory = True
 
imap.Logger.Path = "C:\imap.log"
 
imap.Username = "dave@blah.com"
imap.Password = "test"
imap.Login()
 
'create a new folder
imap.CreateFolder("NewFolder")
 
'write out the log, the username and password will be masked
Console.WriteLine(imap.Logger.ToString())
 
imap.Disconnect()
 
Console.WriteLine("Done")
Console.ReadLine()