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. Supports TLS 1.3/1.2/1.1/1.0.

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.

Up-to-date TLS support

Rebex Secure Mail supports modern TLS versions on all mainstream platforms. This ensures that your emails are transfered securely and reliably. Rebex Secure Mail supports both implicit or explicit TLS/SSL and provides a rich set of security features. You'll find APIs for TLS/SSL security, X.509 certificates, and more.

  • TLS 1.3 on mainstream platforms including .NET 3.5-4.8 on Windows 7 (or Windows XP SP3 with plugins)
  • TLS 1.2, 1.1, 1.0 on all platforms (including .NET Compact Framework 3.5/3.9)
  • Elliptic Curve DSA and Elliptic Curve Diffie-Hellman ciphers (requires a plugin on some platforms)
  • AES/GCM ciphers
  • Elliptic Curve DSA and Elliptic Curve Diffie-Hellman ciphers
    (requires plugin on some platforms)
  • SHA-2 certificates
  • SHA-2 hashing algorithms
  • Server Name Indication (SNI) extension
  • Renegotiation Indication extension
  • Support for legacy SSL 3.0 protocol

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-4.8

.NET Core

1.x, 2.x, 3.0

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.