MailKit
A cross-platform .NET library for IMAP, POP3, and SMTP.
Install / Use
/learn @jstedfast/MailKitREADME
MailKit
| Package |Latest Release|Latest Build|
|:----------|:------------:|:----------:|
|MimeKit||
|
|MimeKitLite|
||
|MailKit|
|
|
|MailKitLite|
||
| Platform |Build Status|Code Coverage|Static Analysis|
|:------------|:----------:|:-----------:|:-------------:|
|Linux/Mac||
|
|
|Windows |
|
|
|
What is MailKit?
MailKit is a cross-platform mail client library built on top of MimeKit.
Donate
MailKit is a personal open source project that I have put thousands of hours into perfecting with the goal of making it the very best email framework 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. It also helps motivate me to continue working on the project.
<a href="https://github.com/sponsors/jstedfast" _target="blank"><img alt="Click here to lend your support to MailKit by making a donation!" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif"></a>
Features
- SASL Authentication
- Supports the following mechanisms: CRAM-MD5, DIGEST-MD5, LOGIN, NTLM, PLAIN, SCRAM-SHA-1[-PLUS], SCRAM-SHA-256[-PLUS], SCRAM-SHA-512[-PLUS], OAUTHBEARER and XOAUTH2
- Proxy Support
- SMTP Client
- Supports all of the SASL mechanisms listed above.
- Supports SSL-wrapped connections via the "smtps" protocol.
- Supports client SSL/TLS certificates.
- Supports the following extensions: SIZE, DSN, AUTH, 8BITMIME, PIPELINING, BINARYMIME, CHUNKING, STARTTLS, and SMTPUTF8
- All APIs are cancellable.
- Async APIs are available.
- POP3 Client
- Supports all of the SASL mechanisms listed above.
- Also supports authentication via APOP and
USER/PASS. - Supports SSL-wrapped connections via the "pops" protocol.
- Supports client SSL/TLS certificates.
- Supports the following extensions: TOP, UIDL, EXPIRE, LOGIN-DELAY, PIPELINING, SASL, STLS, UTF8, UTF8=USER, and LANG
- All APIs are cancellable.
- Async APIs are available.
- IMAP4 Client
- Supports all of the SASL mechanisms listed above.
- Supports SSL-wrapped connections via the "imaps" protocol.
- Supports client SSL/TLS certificates.
- Supports the following extensions: ACL, QUOTA, LITERAL+, IDLE, NAMESPACE, ID, CHILDREN, LOGINDISABLED, STARTTLS, MULTIAPPEND, UNSELECT, UIDPLUS, CONDSTORE, ESEARCH, SASL-IR, 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 X-GM-EXT1 (X-GM-MSGID, X-GM-THRID, X-GM-RAW and X-GM-LABELS)
- All APIs are cancellable.
- Async APIs are available.
- Client-side sorting and threading of messages.
Goals
The main goal of this project is to provide the .NET world with robust, fully featured and RFC-compliant SMTP, POP3, and IMAP client implementations.
All of the other .NET IMAP client implementations that I could find suffer from major architectural
problems such as ignoring unexpected untagged responses, assuming that literal string tokens will
never be used for anything other than message bodies (when in fact they could be used for pretty
much any string token in a response), assuming that the way to find the end of a message body in a
FETCH response is by scanning for ") UID", and not properly handling mailbox names with international
characters to simply name a few.
IMAP requires a LOT of time spent laboriously reading and re-reading the IMAP specifications (as well as the MIME specifications) to understand all of the subtleties of the protocol and most (all?) of the other Open Source .NET IMAP libraries, at least, were written by developers that only cared enough that it worked for their simple needs. There's nothing necessarily wrong with doing that, but the web is full of half-working, non-RFC-compliant IMAP implementations out there that it was finally time for a carefully designed and implemented IMAP client library to be written.
For POP3, libraries such as OpenPOP.NET are actually fairly decent, although the MIME parser is far too strict - throwing exceptions any time it encounters a Content-Type or Content-Disposition parameter that it doesn't already know about, which, if you read over the mailing-list, is a problem that OpenPOP.NET users are constantly running into. MailKit's Pop3Client, of course, doesn't have this problem. It also parses messages directly from the socket instead of downloading the message into a large string buffer before parsing it, so you'll probably find that not only
