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 →MimeKit is a fast, robust and standards-compliant MIME parser and message construction library. Pair it with MailKit for SMTP, POP3 and IMAP.
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);
Everything you need to create, parse, sign, encrypt, authenticate, send and receive email in any .NET application.
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 →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 →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 →Full support for S/MIME v3.2 and OpenPGP encryption, decryption and signing, as well as DKIM, ARC and DMARC.
Working with S/MIME →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 →Standards-compliant yet forgiving: MimeKit copes with the broken, malformed and malicious messages found in real-world mailboxes.
Parser options →Full-featured clients for every major mail protocol, including both IMAP4rev1 and IMAP4rev2.
SmtpClient →More than 40 IMAP extensions, including IDLE, CONDSTORE/QRESYNC, COMPRESS, MOVE, METADATA, NOTIFY and Gmail's X-GM-EXT-1.
ImapClient →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 →SSL/TLS and STARTTLS on every protocol, with support for client certificates and custom certificate validation.
Connect through SOCKS4/4a, SOCKS5 and HTTP/HTTPS proxies.
Proxy clients →Every operation has an async counterpart and supports cancellation, so your apps stay responsive.
MimeKit and MailKit are open source under the MIT license and completely free for commercial use.
View on GitHub →Windows, Linux, Mac, iOS, Android and anywhere else .NET runs, including .NET MAUI apps.
A clean, well-documented API that makes even the most complex email tasks doable.
MimeKit and MailKit are available on NuGet.
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.
Download source archives for every release, or clone the repositories from GitHub.
Questions, bug reports or feature requests? Here's where to go.
The documentation portal is the first place to go for help. It has full API coverage and a growing number of examples.
Stack Overflow is a great place to ask questions about MimeKit and MailKit.
File bug reports and feature requests on the GitHub issue trackers for MimeKit and MailKit.
MimeKit and MailKit are personal open source projects that I have put thousands of hours into perfecting by continuously improving the API based on feedback from developers like yourself, writing documentation, and optimizing with the goal of making them not only the very best email framework for .NET, but the best email framework for any programming language.
If MimeKit and/or MailKit have been helpful to you, please consider sponsoring. Your support is appreciated.
Sponsor on GitHubMimeKit and MailKit are open source under the MIT license and are free for commercial use.