MimeKit, simply the best MIME parser out there for C#

I have done a lot of work on MIME, meaning the Multi purpose Internet Message Exchange standard. This standard is at the heart of being able to send and receive emails, over e.g. POP3 and/or SMTP – Which are the two most commonly used standards for retrieving and sending emails.

Every time you want to send an email, you are basically using the MIME standard, which allows for “multiple entities”, such as attachments, HTML views, plain text views, etc. Hence, at least having a partial understanding of how MIME works, is crucial in order to be able to create software that somehow sends or retrieves emails. I have researched several different MIME parsers in the .Net space, and I have concluded with the following basically.

Unless you’re using MimeKit, you’re doing something wrong!

Every now and then, some geek comes around, and is able to do some really incredible thing. Jeffrey Steadfast is one of these guys. He has created the fastest MIME parser in existence previously in C, and over the last couple of years, implemented a MIME parser for the CLR. MimeKit can be found here. If you don’t believe me, look at his performance benchmark of his own baby compared to the alternative MIME parsers out there, at his GitHub website for MimeKit.

MIME is a notoriously difficult to understand standard (like most of them are), full of arcane language, and cross-references to other standards. Luckily, Jeffrey have created a brilliant API, which allows you to more easily understand how to create MIME messages, without having to wade through tons of documentation.

Below I have a video, demonstrating encrypting and putting more than 5000 PNG files into a single MIME message, using MimeKit at its core. On my MacBook Air from 2015, it is able to do that job in roughly 7 seconds. For the record, that’s staggeringly fast!

Even Microsoft has publicly announced that it is the superior MIME parser, indirectly, by making it become the recommended MIME parser, through making the old SmtpClient obsolete, and encouraging its users to use MailKit instead. MimeKit simply rules!


One thought on “MimeKit, simply the best MIME parser out there for C#

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.