github.com/mubelotix/email-parser ↗
The fastest and lightest mail parsing Rust library.
Open this visualization on its own page →
Contributors
2
Lines of Code
460
From
2020-06-29
To
2021-02-14
About mubelotix/email-parser
email-parser is a Rust library designed for parsing email messages with a focus on performance and minimal overhead. The library aims for full compliance with RFC 5322, the standard for internet message format, while deliberately excluding support for obsolete syntax to maintain speed. It handles both standard email headers and MIME multipart messages, with planned support for PGP encryption.
The library's key differentiator is its granular approach to parsing complexity. Rather than parsing all possible email headers regardless of whether they're needed, users can enable only the specific headers their application requires, leaving others as unstructured data. This selective parsing can roughly double performance for emails where most headers are unused. The library achieves additional efficiency through extensive use of Cow (copy-on-write) references instead of owned strings, keeping approximately 90% of parsed data as references to the original input.
email-parser comes with zero dependencies by default and only one small optional dependency, making it lightweight for projects with strict dependency budgets. It includes benchmarks to verify its performance claims, though the developers note that parsing speed can vary depending on email content structure. The project is distributed under the MIT license.