Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Stalwart mail-parser

github.com

  • Free plan
  • macOS
  • Linux
  • Self-hosted
7.4 Club score Visit github.com

What Stalwart mail-parser is

Stalwart mail-parser is a free, open-source Rust library for parsing email messages. It supports Internet Message Format (RFC 5322), MIME (RFC 2045–2049), and other internet messaging RFCs, while attempting to handle messages that depart modestly from those standards. Parsed output includes a MIME tree plus lists of text bodies, HTML bodies, and attachments. When one representation is absent, it can convert HTML to plain text or plain text to HTML. SIMD kernels accelerate boundary and header scanning on supported targets, and transfer decoding and charset conversion are deferred until content is read. Returned strings generally reference the original input message. The parser recognizes WHATWG encoding labels; the optional full_encoding feature adds legacy multibyte sets such as Shift_JIS, Big5, and GB18030. Defaults allow nesting depth of 64, 10,000 MIME parts, and three decoded nested-message levels. No Cargo feature is enabled by default, while serde adds serialization support. Rust 1.98 is required. The library uses MIT or Apache-2.0 licensing, parses attachments, and does not build messages.

Who it suits

It suits Rust developers who need email parsing for self-hosted or Linux and macOS software. It is not the component to choose for constructing outgoing messages.

Good to know, and what to watch

  • Supports RFC 5322 and MIME parsing
  • Exposes text, HTML, and attachment lists
  • Lazy decoding can defer content work
  • Optional legacy charset support
  • MIT or Apache-2.0 licensed
  • Requires Rust 1.98 or later
  • Does not build email messages
  • Parser defaults impose nesting and part limits
  • No Cargo feature is enabled by default

mail-parser

Free

Open-source library

Free

Open source

The verdict

Stalwart mail-parser focuses on reading and interpreting email content, with MIME structure, body lists, attachments, and configurable charset support. Developers should account for its Rust requirement, parser limits, and separate mail-builder component for message creation.

What the maker publishes

Build requirement
The minimum supported Rust version is 1.98, and no feature flags are enabled by default. source
Character sets
It recognizes 41 character sets, with additional legacy multibyte charset decoding available through the optional full_encoding feature. source
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. source
Compatibility
The parser attempts to parse nonconforming messages when they do not deviate too far from the standard. source
Integration
The library is used in production by Stalwart Mail Server. source
License
The library is available under either the MIT License or Apache License 2.0, at the user's option. source
License
The library is available under either the Apache License 2.0 or the MIT license, at the user's option. source
Limits
The parser defaults to a nesting depth of 64, 10,000 MIME parts, and three levels of transfer-encoded nested messages. source
Memory use
The README says practically all strings returned by the library reference the raw input message. source
Memory use
The project describes the parser as zero-copy, with practically all returned strings referencing the raw input message. source
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. source
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. source
Not a message builder
The library does not build email messages; the README points to the separate mail-builder crate for that functionality. source
Not included
The library does not build email messages; the project points to the separate mail-builder crate for that functionality. source
Optional features
No Cargo feature is enabled by default; the optional serde feature adds serialization support for Message and related types. source
Parser limits
Defaults include a nesting depth of 64, up to 10,000 MIME parts, and up to 3 levels of decoded nested messages. source
Performance
The parser uses SIMD kernels for boundary and header scanning on supported targets and decodes message content lazily when it is read. source
Performance design
It uses SIMD kernels on supported targets and defers transfer decoding and charset conversion until content is read. source
Production use
The README says mail-parser is used in production environments worldwide by Stalwart Mail Server. source
Robust parsing
The library aims to parse non-conformant email messages when they do not deviate too far from the standard. source
Rust requirement
The minimum supported Rust version is 1.98. source
Security testing
The project says every library function has been fuzzed and tested with MIRI. source
Testing and security
The project says every library function has been fuzzed and thoroughly tested with MIRI. source
What it does
mail-parser is an email parsing library written in Rust that supports Internet Message Format (RFC 5322), MIME (RFC 2045–2049), and other internet messaging RFCs. source

Checked against the maker's pages on 9 Oct 2026.