- Home
- Email Parsing Software
- Stalwart mail-parser
Stalwart mail-parser
What it is
Stalwart mail-parser is a free, open-source Rust library for parsing email messages. It supports Internet Message Format, MIME, and other internet messaging RFCs, and attempts to handle messages that stray somewhat from the standards. Its output includes a MIME tree and lists of text bodies, HTML bodies, and attachments. When one body format is missing, it can convert the other between HTML and plain text. On supported targets, SIMD kernels scan boundaries and headers; transfer decoding and character-set conversion are deferred until content is read. The library recognizes WHATWG encoding labels, with optional full_encoding support for legacy multibyte sets including Shift_JIS, Big5, and GB18030. Default limits include 64 levels of nesting, 10,000 MIME parts, and three levels of decoded nested messages. No Cargo features are enabled by default; serde adds serialization support. The project says its functions have been fuzzed and tested with MIRI, and that Stalwart Mail Server uses it in production. It requires Rust 1.98 or later and is available under the MIT or Apache-2.0 license. It parses email but does not build messages; the project points to mail-builder for that task.
For and against
For
- Parses email formats including MIME and RFC 5322.
- Provides text, HTML, and attachment content.
- Defers decoding until message content is read.
- Free under MIT or Apache-2.0 licensing.
Against
- Requires Rust 1.98 or later.
- No Cargo feature is enabled by default.
- Does not build email messages.
The verdict
mail-parser offers email and MIME parsing with body and attachment extraction, plus optional support for legacy character sets. Developers who need message creation will need a separate tool.
Who it suits
This library suits Rust developers who need to parse email content, MIME parts, and attachments. It is not for building outgoing messages.
Plans and prices
mail-parser
No paid plan or usage limits stated on the repository page
Read 9 Oct 2026 · github.com
Open-source library
Rust email parsing library · MIT or Apache-2.0 license
Read 4 Oct 2026 · github.com
On the record
- Build requirement
- The minimum supported Rust version is 1.98, and no feature flags are enabled by default.github.com · read 9 Oct 2026
- Character sets
- It recognizes 41 character sets, with additional legacy multibyte charset decoding available through the optional full_encoding feature.github.com · read 9 Oct 2026
- Charsets
- The library recognizes WHATWG encoding labels, and its optional full_encoding feature adds support for legacy multibyte character sets including Shift_JIS, Big5, and GB18030.github.com · read 4 Oct 2026
- Compatibility
- The parser attempts to parse nonconforming messages when they do not deviate too far from the standard.github.com · read 9 Oct 2026
- Integration
- The library is used in production by Stalwart Mail Server.github.com · read 9 Oct 2026
- License
- The library is available under either the Apache License 2.0 or the MIT license, at the user's option.github.com · read 9 Oct 2026
- Limits
- The parser defaults to a nesting depth of 64, 10,000 MIME parts, and three levels of transfer-encoded nested messages.github.com · read 9 Oct 2026
- Memory use
- The project describes the parser as zero-copy, with practically all returned strings referencing the raw input message.github.com · read 9 Oct 2026
- Message bodies
- It exposes text, HTML, and attachment body lists, and converts HTML to plain text or plain text to HTML when the other format is absent.github.com · read 9 Oct 2026
- Message content
- It provides a MIME tree and lists of text bodies, HTML bodies, and attachments; it can convert HTML to plain text and plain text to HTML when an alternative is absent.github.com · read 4 Oct 2026
- Not a message builder
- The library does not build email messages; the README points to the separate mail-builder crate for that functionality.github.com · read 4 Oct 2026
- Not included
- The library does not build email messages; the project points to the separate mail-builder crate for that functionality.github.com · read 9 Oct 2026
- Optional features
- No Cargo feature is enabled by default; the optional serde feature adds serialization support for Message and related types.github.com · read 4 Oct 2026
- Parser limits
- Defaults include a nesting depth of 64, up to 10,000 MIME parts, and up to 3 levels of decoded nested messages.github.com · read 4 Oct 2026
- Performance
- The parser uses SIMD kernels for boundary and header scanning on supported targets and decodes message content lazily when it is read.github.com · read 9 Oct 2026
- Performance design
- It uses SIMD kernels on supported targets and defers transfer decoding and charset conversion until content is read.github.com · read 4 Oct 2026
- Production use
- The README says mail-parser is used in production environments worldwide by Stalwart Mail Server.github.com · read 4 Oct 2026
- Robust parsing
- The library aims to parse non-conformant email messages when they do not deviate too far from the standard.github.com · read 4 Oct 2026