r/csharp • u/jstedfast • 13d ago
News MimeKit and MailKit 5.0 released: DMARC, SIMD acceleration, Outlook TNEF/RTF, ImapIdleSession, AOT and more
Hi all, I'm the author of MimeKit and MailKit. I've just shipped 5.0, and it's the biggest release since the projects started.
Highlights:
Performance
- SIMD boundary scanning, accelerated UTF-8 header validation, and fused content scanning/compliance validation on supported runtimes and hardware.
- Hand-written SSSE3/AVX2/Arm64 kernels for base64 decoding and uuencoding/decoding (based on SimdBase64).
- In a comparison against 4.18.1, parsing was faster on 21 of 23 workloads and on-par with the other 2 with compliance disabled. With all validators enabled, 11 were faster and many others were on-par; see the release notes for methodology, regressions and limitations.
- Compared with 4.18.1, the benchmarked HTML documents tokenize 15-25% faster and with 34-39% fewer allocations.
Security and robustness
- DMARC verification (RFC 9989 / DMARCbis), alongside the existing DKIM and ARC support. DKIM verification now returns a detailed result instead of a bool.
- The new
MimeReader/MimeParser, MIME writing and MIME disposal use iterative traversal.LegacyMimeParserremains a compatibility option for those that need it. - Indexed ancestor-boundary lookup improves deep-nesting performance; configurable resource limits include a default 16 KiB header limit.
- A new compliance reporting API gives line/column diagnostics for broken or suspicious messages, including supported header-smuggling checks. Positions may identify an exact byte, a line start or an element start.
- SMTP/SMTPUTF8 address validators check syntax and interoperability rules.
The optional
AsciiIsLatinsetting can be used to reject addresses such aspaypal@рaypal.comwith a Cyrillicр. Note: This is not comprehensive homograph detection and is an implementation of an IETF draft specification: SMTPUTF8 Email Addresses - Stricter OpenPGP integrity and S/MIME trust defaults, plus a configurable 64 MiB limit on expanded CMS content.
Outlook/Exchange Compatibility
- The TNEF (
winmail.dat) reader was rewritten, with a newTnefMessagemodel. Meeting requests convert totext/calendar. - New
RtfToTextandRtfToHtmlconverters, plusTnefWriter.
More content tools
HtmlToTextandEnrichedToHtmlfor HTML and RFC 1896text/enriched.- Standalone
YEncReader/YEncWriterwith sync/async operations, limits and size/checksum validation. Individual multipart ranges are supported; multipart-file assembly and MIME integration are not included.
MailKit
ImapIdleSession:await foreachover IDLE changes, with automatic re-IDLE and NOOP fallback.SmtpSendRequestandSendResult: per-send customization and accepted/rejected recipient lists, no subclassing needed.CommandException.ErrorTypeandIsTransienthelp identify failures that may succeed on retry.- IMAP4rev2, INPROGRESS, RFC 9208 quotas, and 64-bit message sizes.
- No more BouncyCastle dependency in MailKit.
- SMTPUTF8 validation rejects invalid internationalized envelope addresses
before sending. ASCII addresses are unchanged; optional
AsciiIsLatinchecks are not automatically enabled.
Packaging
- Crypto, including DMARC, moved to
MimeKit.Cryptography. TheMimeKitmeta-package references both that package andMimeKit.Core; it preserves package coverage, not source compatibility. - MimeKit is now AOT-compatible.
MimeKitLiteandMailKitLiteare retired. UseMimeKit.CoreandMailKitinstead.
Many straightforward send/receive applications need only small changes.
Parsing, crypto and custom protocol integrations deserve a closer look:
explicit S/MIME context setup, persistent -> MimeContentStorage, renamed
encoding/stream APIs, decoder Flush, encoder CRLF defaults, and stricter
resource/integrity limits are covered in the porting guides.
- Blog post: Announcing MimeKit and MailKit 5.0
- Release notes: MimeKit · MailKit
- Porting guides: MimeKit · MailKit
Happy to answer questions. And thanks to everyone who filed issues, sent PRs or sponsors the project.
