Version: 3.0.3.2
Securely send, receive, preview, edit, sign/verify, and encrypt/decrypt email messages in any .NET project. 

Imap .NET Component

Use the secure Imap .NET Component to easily manage and download messages from any IMAP4 server. A local object model makes remote mail management easy, with no knowledge of IMAP4 commands required! Features include:

  • Select secure (SSL 2.0, SSL 3.0, PCT, TLS) or unencrypted TCP communications.
  • There is no need to understand the IMAP4 protocol. Use the Imap component's intuitively named properties and methods and the appropriate command is sent to the server.
  • Server-side mailboxes are represented as Mailbox objects. Use this object to change the properties of, or get data about a mailbox.
  • Multiple mailboxes represented as ImapMailboxCollection objects. Use this object to manage mailboxes and perform bulk operations on them.
  • Server-side messages are represented as ImapMessage objects. Use this object to change the flags of a message, or get message data.
  • Multiple messages are represented as ImapMessageCollection objects. Use this object to manage messages and perform bulk operations on them.
  • Decrypt Secure MIME (S/MIME) messages. 
  • Flexible message retrieval enables the developer to retrieve an entire message, headers only, attachments only, or any part desired!
  • All synchronous methods of the Imap component have an asynchronous counterpart. Use the asynchronous method to begin an action, and handle the completion of that action in the accompanying event.
  • Imap.Connection property exposes the TCP connection used to send data. Use this object to get connection-level information, or perform a trace on all data passing through the connection.
  • Other events include Progress (raised when a message is transferring), ConnectedChanged (raised when the state of the connection has changed), and BusyChanged (raised when the Imap component is busy sending data).
  • Built-in editors lets you test the Imap component without writing any code.
  • 1000+ page documenation contains dozens of walkthroughs, demonstrating the use of the Imap component.
  • Full sample applications include a fully-working Imap Client.
  • Integrates with all versions of Visual Studio and supports C#, VB.NET, ASP.NET, Delphi 8, C# Builder, and other .NET compliant development environments.

Looking for the ActiveX version of this component?

Interface

Public Constructors
Imap Overloaded. Initialize a new instance of the Imap class.
Public Properties
AutoList Gets or sets a value which determines if a list is performed upon login.
AutoPurge Gets or sets a value which determines if messages are automatically expunged.
Busy Returns true if a method is currently in use.
Capabilities Gets an array of strings representing the capabilites of the IMAP server.
Certificate Gets or sets the certifcate to be used for client authentication.
Connected Gets the connected state of the connection.
Connection Gets the Tcp component instance used for the connection.
CurrentMailbox Gets or sets the Mailbox object representing the currently selected mailbox.
Delimiter Gets the delimiter used to separate mailbox levels.
DoEvents Gets or sets a value that controls the processing of events during blocking method calls.
Editor In Visual Studio.NET, displays an interactive form to use to test real time protocol operations.
Idle Controls the current idle state of the Imap component
Mailboxes Gets a MailboxCollection containing representations of mailboxes that are available on the server.
Security Gets or sets a value that controls use of SSL encryption over the TCP connection.
Tag Gets or sets an object reference that can be used to associate this instance with any other.
Timeout Specifies the maximum number of milliseconds to wait for responses to commands.
UseAuthentication Controls whether the server certificate should be authenticated.
UseMemoryStreams Controls whether attachments are decoded and stored as FileStreams or as MemoryStreams when a message is retrieved.
Public Methods
BeginExamine Begin to asynchronously select a mailbox by using the EXAMINE command.
BeginInvoke Overloaded. Begins to send the specified user command.
BeginList Begins to asynchronously list a subset of mailboxes found on the IMAP server.
BeginLogin Overloaded. Begins to asynchronously log into an IMAP server at a specified port using a username and password.
BeginLogout Begins to asynchronously log out and closes the connection.
BeginNoop Begins to asynchronously send a NOOP command to keep the user logged in and to poll for changes.
Examine Select a mailbox by using the EXAMINE command.
Invoke Overloaded. Sends the specified user command.
List Lists a subset of mailboxes found on the IMAP server.
Login Overloaded. Logs into an IMAP server at a specified port using a username and password.
Logout Logs out and closes the connection.
Noop Sends a NOOP command to keep the user logged in and to poll for changes.
Public Events
Alert Raised when an alert that must be shown to the user is received.
BusyChanged Raised when the value of the Object.Busy property changes.
CertificateReceived Raised when the server's certificate is received.
CertificateRequested Raised when the server is requesting a client certificate.
ConnectedChanged Raised when the value of the Object.Connected property changes.
EndClear Raised when the asynchronous operation started by the ImapMessageCollection.BeginClear method completes.
EndCopy Raised when the asynchronous operation started by the Mailbox.BeginCopy method completes.
EndExamine Raised when the asynchronous operation started by the Imap.BeginExamine method completes.
EndGetMessage Raised when any asynchronous operation which retrieves messages completes.
EndGetPart Raised when the asynchronous operation started by the ImapMessage.BeginGetPart method completes.
EndInvoke Raised when the asynchronous operation started by the Imap.BeginInvoke method completes.
EndList Raised when the asynchronous operation started by the Imap.BeginList method completes.
EndLogin Raised when the asynchronous operation started by the Imap.BeginLogin method completes.
EndLogout Raised when the asynchronous operation started by the Imap.BeginLogout method completes.
EndMailboxAdd Raised when the asynchronous operation started by the MailboxCollection.BeginAdd method completes.
EndMailboxRemove Raised when the asynchronous operation started by the MailboxCollection.BeginRemove method completes.
EndMessageAdd Raised when any asynchronous operation started by the ImapMessageCollection.BeginAdd method completes.
EndNoop Raised when the asynchronous operation started by the Imap.BeginNoop method completes.
EndPurge Raised when the asynchronous operation started by the Mailbox.BeginPurge method completes.
EndRefresh Raised when the asynchronous operation which refreshes the state of an object completes.
EndSearch Raised when any asynchronous operation started by the Mailbox.BeginSearch method completes.
EndSet Raised when the asynchronous operation started by the Mailbox.BeginSet method completes.
EndSubscribe Raised when the asynchronous operation started by the Mailbox.BeginSubscribe method completes.
EndUnsubscribe Raised when the asynchronous operation started by the Mailbox.BeginUnsubscribe method completes.
LineReceived Raised each time a line response is received from the server.
Mailbox Raised when information about a mailbox is received while performing a listing.
Progress Raised repeatedly while a message or message section is retrieved.
Trace Raised when data has been sent/received.
Update Raised when an update is received from the server.

Code Example

How easy is the Imap component to use? The following example demonstrates moving Read messages from "INBOX" to a "Deleted Items" box.

VB.NET Example
Private Sub DoMove()
   ' Demonstrate moving Read messages from "INBOX" to a "Deleted Items" box
   Try
      ' Do synchronous login with AutoList
      Imap1.Login("myServer", "myAccount", "myPassword")

      ' Create Mailbox objects for easier reference
      Dim InboxBox As Mailbox = Imap1.CurrentMailbox ' After Login with AutoList, this will be 
      "INBOX"
      Dim DeletedBox As Mailbox = Imap1.Mailboxes("Deleted Items")

      ' Update Messages Count in "Deleted Items" box
      DeletedBox.Refresh()

      ' Display Messages Count in both boxes
      LabelDisplay.Text = InboxBox.Messages.Count.ToString() + "  " + DeletedBox.Messages.Count.
      ToString()

      ' Get an array of ImapMessages with just flags
      Dim Messages As ImapMessage() = InboxBox.Get(InboxBox.Messages(0), InboxBox.Messages
      (InboxBox.Messages.Count-1), ImapMessageSections.Flags)

      ' Copy Read Messages to "Deleted Items" box and Mark them for Deletion
      Dim Msg as ImapMessage
      For Each Msg in Messages
        If Msg.Seen Then 'If Seen flag is set 
           Msg.CopyTo(DeletedBox) ' Copy to "Deleted Items" box
           Msg.Delete = True ' Set deleted flag in "INBOX"
        End If
      Next

      'Permanently Remove Copied Messages from "INBOX"
      InboxBox.Purge()

      'Update Messages Count in "Deleted Items"
      DeletedBox.Refresh()

      'Display new Messages Counts
      LabelDisplay.Text = InboxBox.Messages.Count.ToString() + "  " + DeletedBox.Messages.Count.
      ToString()

      'Logout from server
      Imap1.Logout()
   
   Catch Ex As Exception
       ' Show MessageBox if error occurs
       MessageBox.Show(Ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
   End Try
End Sub