Email for .NET, done right.

MimeKit is a fast, robust and standards-compliant MIME parser and message construction library. Pair it with MailKit for SMTP, POP3 and IMAP.

Program.cs
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;

var message = new MimeMessage ();
message.From.Add (new MailboxAddress ("Joey", "joey@friends.com"));
message.To.Add (new MailboxAddress ("Phoebe", "phoebe@friends.com"));
message.Subject = "How you doin'?";
message.Body = new TextPart ("plain") {
    Text = "Hey Phoebe, want to grab lunch?"
};

using var client = new SmtpClient ();
await client.ConnectAsync ("smtp.friends.com", 587,
    SecureSocketOptions.StartTls);
await client.AuthenticateAsync ("joey", "password");
await client.SendAsync (message);
await client.DisconnectAsync (true);

Why MimeKit and MailKit?

Everything you need to create, parse, sign, encrypt, authenticate, send and receive email in any .NET application.

MimeKit: parse, create and secure messages

World-Class

Parse any message with MimeKit's powerful MIME parser. Properly handles any character encoding, and decodes Microsoft TNEF (winmail.dat) attachments and RTF message bodies.

Parsing messages →

High Performance

MimeKit's parser is orders of magnitude faster than other .NET MIME parsers, with SIMD hardware acceleration on modern x86 and Arm CPUs. Parse gigabytes of mail in seconds rather than minutes.

How it's optimized →

Built for Big Mailboxes

Stream through multi-gigabyte mbox files with pooled buffers and lazily-decoded headers. Persistent streams let attachments reference the original file instead of being copied into memory.

MimeParser →

Secure

Full support for S/MIME v3.2 and OpenPGP encryption, decryption and signing, as well as DKIM, ARC and DMARC.

Working with S/MIME →

Content Conversion

Built-in converters for plain text, format=flowed, HTML and RTF make it easy to render message bodies or turn them into clean text.

Text converters →

Robust

Standards-compliant yet forgiving: MimeKit copes with the broken, malformed and malicious messages found in real-world mailboxes.

Parser options →

MailKit: send and receive mail

SMTP, POP3 & IMAP

Full-featured clients for every major mail protocol, including both IMAP4rev1 and IMAP4rev2.

SmtpClient →

Extensive IMAP Support

More than 40 IMAP extensions, including IDLE, CONDSTORE/QRESYNC, COMPRESS, MOVE, METADATA, NOTIFY and Gmail's X-GM-EXT-1.

ImapClient →

Modern Authentication

OAuth 2.0 (OAUTHBEARER and XOAUTH2) for Gmail and Microsoft 365, plus SCRAM-SHA-256/512 with channel binding, NTLM and more.

OAuth 2.0 →

Secure Connections

SSL/TLS and STARTTLS on every protocol, with support for client certificates and custom certificate validation.

Proxy Support

Connect through SOCKS4/4a, SOCKS5 and HTTP/HTTPS proxies.

Proxy clients →

Async & Cancellable

Every operation has an async counterpart and supports cancellation, so your apps stay responsive.

Both libraries

Open Source

MimeKit and MailKit are open source under the MIT license and completely free for commercial use.

View on GitHub →

Run Anywhere

Windows, Linux, Mac, iOS, Android and anywhere else .NET runs, including .NET MAUI apps.

Easy To Use

A clean, well-documented API that makes even the most complex email tasks doable.

Install

MimeKit and MailKit are available on NuGet.

NuGet (recommended)

dotnet add package MimeKit
dotnet add package MailKit

MailKit depends on MimeKit, so installing MailKit brings MimeKit along with it. You can also use the Visual Studio NuGet Package Manager.

Source code

Download source archives for every release, or clone the repositories from GitHub.

Help

Questions, bug reports or feature requests? Here's where to go.

Documentation

The documentation portal is the first place to go for help. It has full API coverage and a growing number of examples.

Stack Overflow

Stack Overflow is a great place to ask questions about MimeKit and MailKit.

Issue Tracker

File bug reports and feature requests on the GitHub issue trackers for MimeKit and MailKit.