Receive and read emails in C# and VB.NET with the GemBox.Email component using the Internet Mail Access Protocol (IMAP).

GemBox.Email is a .NET component that enables developers to compose, receive, and send email messages using the IMAP, POP, and SMTP protocols simply and efficiently from .NET applications.
You can use GemBox.Email for connecting to all major email providers. Also, it supports loading and saving emails, so you can store your emails exactly as they were received from the email server (with all of their headers and attachments).
GemBox.Email Free is free of charge, while GemBox.Email Professional is a commercial version that is licensed per developer.
For more information, see GemBox.Email Features or try our examples.

The following example demonstrates how to receive and read email with the Internet Mail Access Protocol (IMAP):

C# code

// Create IMAP client.
using (ImapClient imap = new ImapClient("<ADDRESS>"))
{
    // Connect and login to email server.
    imap.Connect();
    imap.Authenticate("<USERNAME>""<PASSWORD>");

    // Select INBOX folder
    imap.SelectInbox();

    // Download and receive first email message available on server.
    MailMessage message = imap.GetMessage(1);

    // Read and display email's subject and message.
    Console.WriteLine(message.Subject);
    Console.WriteLine(message.BodyText);
}

VB.NET code

' Create IMAP client.
Using imap As New ImapClient("<ADDRESS>")
    ' Connect and login to email server.
    imap.Connect()
    imap.Authenticate("<USERNAME>""<PASSWORD>")

    ' Select INBOX folder
    imap.SelectInbox()

    ' Download and receive first email message available on server.
    Dim message As MailMessage = imap.GetMessage(1)

    ' Read and display email's subject and message.
    Console.WriteLine(message.Subject)
    Console.WriteLine(message.BodyText)
End Using