using (var imap = new Rebex.Net.Imap())
{
  // connect and login to Gmail IMAP server
  imap.Connect("imap.gmail.com", SslMode.Implicit);
  imap.Login(username, password);

  // get list of new messages in Inbox
  imap.SelectFolder("Inbox");
  var list = imap.Search(ImapSearchParameter.Unread);

  // print subjects of those messages
  foreach (var info in list)
  {
	Console.WriteLine(info.Subject);
  }
}
				
Show me more code...

Mail library for C# and VB.NET developers. Provides all you need for sending, receiving, encrypting, decrypting, signing, verifying, loading, saving and processing e-mails messages.

Includes:

Why Rebex Secure Mail?

SMTP and PickupDirectory for sending emails

Send a message using a single line of code. TLS/SSL support. Direct sending to recipient's SMTP server.

IMAP for advanced mailbox access

Upload and download messages using IMAP protocol. TLS/SSL support. Work with email folders. Multiple message operations - copy, delete, or set flags for a range of messages in a single operation. Search for messages with specific attributes.

EWS for sending and receiving emails using Exchange

Upload and download messages using Exchange Web Services. TLS/SSL support. Work with email folders. Multiple message operations - copy, delete, or set flags for a range of messages in a single operation. Search for messages with specific attributes. Send emails using EWS.

POP3 for email retrieval

Retrieve messages using a simple POP3 protocol. TLS/SSL support. Retrieve message lists with size, sequence number, unique ID or headers.

Easy-to-use API

Connect, log in, search for new messages, download messages, disconnect. Send email with attachments. It's easy to start developing with our library. Simple code for common use cases.

Signed and encrypted emails (S/MIME)

Supports message encryption and decryption. Supports signing and signature validation. Based on X.509 certificates and Cryptographic Message Syntax.

RSA/OAEP and RSA/PSS on all platforms

Use RSASSA-PSS signatures and RSAES-OAEP encryption with SHA-1, SHA-256, SHA-384 or SHA-512 on all supported platforms including .NET Framework 2.0 and .NET Compact Framework.

Trusted by thousands of .NET developers worldwide

Thousands of developers chose Rebex Secure Mail for adding SMTP, IMAP, POP3, MIME or S/MIME capabilities to their applications.

Many, many more time-tested features

Rebex Secure Mail is a mature and stable component maintained since 2006. We have been adding new features year after year, inspired by user feedback. For example:

  • Task-based Asynchronous API (.NET 4 or later)
  • Automated (or custom) certificate validation
  • Sending raw POP3/SMTP/IMAP commands
  • Sending email on behalf of another user
  • Logging all communication with the server
  • Ability to use Secure Mail in SSIS, SQL CLR and PowerShell
  • FIPS 140-2 compliant mode

And many, many more...

Platforms

.NET Framework

2.0, 3.0, 3.5, 3.5 SP1, 4.0, 4.5.x, 4.6.x, 4.7.x, 4.8 (32-bit and 64-bit)

.NET Core

1.1, 2.1, 2.2 (32-bit or 64-bit)

Mono

4.x, 5.x

Xamarin.iOS

Xamarin.iOS 10.3 or later

Xamarin.Android

Xamarin.Android 8.0 or later

Legacy platforms

.NET Compact Framework

3.5, 3.9

Learn more about supported standards and platforms.

Featured samples

  • WinForms IMAP client - mailbox browser
    Allows you to browse, view and manage mail messages in a remote IMAP mailbox, without actually downloading them. Demonstrates how to connect to IMAP server, download emails, read its content, work with attachments.
  • MIME explorer
    Views contents of structured MIME files (mail message, .EML or .MHT file).
  • WinForms Exchange Client - EWS mailbox browser
    Allows you to browse, view and manage mail messages in a remote Microsoft Exchange mailbox, without actually downloading them. Demonstrates how to connect and authenticate to Exchange server using Exchange Web Services (EWS), browse folders, download and delete emails, read email's content, work with attachments.
  • WinForm mail sender application
    Write an e-mail, add an attachment and send it, either synchronously or in the background, with or without progress bar dialog.
View all 31 C# and VB.NET samples

Satisfied clients

With Rebex IMAP library the number of support calls regarding IMAP protocol problems decreased to almost zero. We are very happy with Rebex Secure Mail and can warmly recommend it to anybody.

Stefan Schultze

CTO, MailStore Software

My team has been using Rebex Secure Mail for .NET for two years and it is really solid. Our service (http://nutshellmail.com/) pulls down millions of POP3 and IMAP messages across all major ISPs on a daily basis. Rebex successfully parses the headers of all these messages. We also use Rebex for our outbound SMTP needs.

We have hit some obscure problems in the past (i.e. GoDaddy's POP3 servers not fully complying with RFC1939); Rebex support was extremely responsive and quickly provided us with a patch.

daviddlyman

NutshelMail.com

I decided to give Rebex.Mail a try and I was very satisfied with the results! Not only is the standard fully and properly respected, it's also significantly faster. It only took half a day to migrate my existing code as the API is very similar to .NET's built-in classes.

Dominic St-Jacques

Amilia Corporation Inc.