Click or drag to resize
MimeKit

Introduction

MimeKit and MailKit are popular fully-featured email frameworks for .NET

Feature Overview
  • Security

    • SASL Authentication

      • Supports the ANONYMOUS, CRAM-MD5, DIGEST-MD5, LOGIN, NTLM, OAUTHBEARER, PLAIN, SCRAM-SHA-1(-PLUS), SCRAM-SHA-256(-PLUS), SCRAM-SHA-512(-PLUS), and XOAUTH2 mechanisms.

    • Supports S/MIME v3.2.

    • Supports OpenPGP.

    • Supports DKIM-Signatures.

    • Supports ARC signatures.

  • SMTP Client

    • Supports SSL and TLS.

    • Supports the STARTTLS, SIZE, DSN, 8BITMIME, PIPELINING, BINARYMIME, and SMTPUTF8 extensions.

  • POP3 Client

    • Supports SSL and TLS.

    • Supports the STLS, UIDL, PIPELINING, UTF8, and LANG extensions.

  • IMAP Client

    • Supports SSL and TLS.

    • Supports the ACL, QUOTA, LITERAL+, IDLE, NAMESPACE, ID, CHILDREN, LOGINDISABLED, STARTTLS, MULTIAPPEND, UNSELECT, UIDPLUS, CONDSTORE, ESEARCH, SASL-ID, COMPRESS, WITHIN, ENABLE, QRESYNC, SORT, THREAD, ANNOTATE, LIST-EXTENDED, ESORT, METADATA, METADATA-SERVER, NOTIFY, FILTERS, LIST-STATUS, SORT=DISPLAY, SPECIAL-USE, CREATE-SPECIAL-USE, SEARCH=FUZZY, MOVE, UTF8=ACCEPT, UTF8=ONLY, LITERAL-, APPENDLIMIT, STATUS=SIZE, OBJECTID, REPLACE, SAVEDATE, XLIST, and Google Mail (X-GM-EXT-1) extensions.

  • Proxy Support

    • Supports HTTP(S), SOCKS4, SOCKS4a, and SOCKS5.

    • Fully cancellable and asynchronous Connect methods.

  • MIME Parser

    • Flexible: allows overriding default classes for any MIME-type.

    • High performance: faster than any other .NET MIME parser on the market. Rivals the performance of even the fastest C++ parsers.

    • Robust: handles a wide variety of broken MIME formatting with ease.

  • All API's that might block allow cancellation via CancellationToken.

  • All API's that perform I/O have async variants.

  • Client-side sorting and threading of messages.

  • Supports .NET 4.5.2, .NET 4.6, .NET 4.7, .NET 4.8, .NET 5.0, .NETStandard 2.0, Xamarin.Android, Xamarin.iOS, Windows Phone 8.1, and more.

History

As a developer and user of email clients, I had come to realize that the vast majority of email client (and server) software had less-than-satisfactory MIME implementations. More often than not these email clients created broken MIME messages and/or would incorrectly try to parse a MIME message thus subtracting from the full benefits that MIME was meant to provide. MimeKit is meant to address this issue by following the MIME specification as closely as possible while also providing programmers with an extremely easy to use high-level API.

This led me, at first, to implement another MIME parser library called GMime which was implemented in C and later added a C# binding called GMime-Sharp.

Now that I typically find myself working in C# rather than lower level languages like C, I decided to begin writing a new parser in C# which would not depend on GMime. This would also allow me to have more flexibility in that I'd be able use Generics and create a more .NET-compliant API.

Performance

While mainstream beliefs may suggest that C# can never be as fast as C, it turns out that with a bit of creative parser design and a few clever optimizations [1][2], MimeKit's performance is actually on par with GMime.

Since GMime is pretty well-known as a high-performance native MIME parser and MimeKit more-or-less matches GMime's performance, it stands to reason that MimeKit is likely unsurpassed in performance in the .NET MIME parser space.

For a comparison, as I blogged here (I have since optimized MimeKit by at least another 30%), MimeKit is more than 25x faster than OpenPOP.NET, 75x faster than SharpMimeTools, and 65x faster than regex-based parsers. Even the commercial MIME parser offerings such as LimiLabs' Mail.dll and NewtonIdeas' Mime4Net cannot even come close to matching MimeKit's performance (they are both orders of magnitude slower than MimeKit).

Donate

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 the very best email frameworks for .NET. I need your help to achieve this.

Donating helps pay for things such as web hosting, domain registration and licenses for developer tools such as a performance profiler, memory profiler, a static code analysis tool, and more.

If MimeKit and/or MailKit have been helpful to you, please consider donating. Your contributions will be greatly appreciated.

Click here to lend your support to MimeKit and MailKit by making a donation!

See Also

Other Resources

Getting Started