Stalwart mail-parser
Stalwart mail-parser is a free, open-source Rust library for parsing email messages.
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, and attempts to process messages that depart somewhat from standards. Its output includes a MIME tree, text and HTML body lists, and attachments. When one body alternative is absent, it can convert HTML to plain text or plain text to HTML. On supported targets, SIMD kernels assist boundary and header scanning; transfer decoding and character-set conversion are deferred until content is read. Most returned strings reference the raw input message. The parser recognizes WHATWG encoding labels, while the optional full_encoding feature adds legacy multibyte sets such as Shift_JIS, Big5, and GB18030. Defaults allow nesting to depth 64, up to 10,000 MIME parts, and up to three levels of decoded nested messages. No Cargo feature is enabled by default; serde adds serialization support. It requires Rust 1.98 or later and is licensed under MIT or Apache-2.0. It parses messages but does not build them; mail-builder is a separate crate for that task.
Good
- Supports Internet Message Format and MIME.
- Returns text, HTML, and attachment bodies.
- Defers decoding until content is read.
- Offers optional legacy charset support.
- Available under MIT or Apache-2.0.
Watch out
- Requires Rust 1.98 or later.
- Does not build email messages.
- No Cargo feature is enabled by default.
Who it suits
mail-parser suits Rust developers who need to read and parse MIME email, including messages with text, HTML, or attachments. It is not a message-building library, and it requires Rust 1.98 or later.
Verdict
mail-parser provides Rust developers with email parsing, MIME body handling, and attachment support. Choose a separate message-building crate if you need to create email messages.
Plans and prices
From Stalwart mail-parser's own pricing page, checked 9 Oct 2026.
| Plan | Price | What it gives you |
|---|---|---|
| mail-parser | Free | No paid plan or usage limits stated on the repository page |
| Open-source library | Free | Rust email parsing library · MIT or Apache-2.0 license |
The facts
Each one read from Stalwart mail-parser's own pages, with the date it was checked.
What it does
- Build requirement
- The minimum supported Rust version is 1.98, and no feature flags are enabled by default.checked 9 Oct 2026
- Character sets
- It recognizes 41 character sets, with additional legacy multibyte charset decoding available through the optional full_encoding feature.checked 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.checked 4 Oct 2026
- Compatibility
- The parser attempts to parse nonconforming messages when they do not deviate too far from the standard.checked 9 Oct 2026
- Integration
- The library is used in production by Stalwart Mail Server.checked 9 Oct 2026
- License
- The library is available under either the Apache License 2.0 or the MIT license, at the user's option.checked 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.checked 9 Oct 2026
- Memory use
- The project describes the parser as zero-copy, with practically all returned strings referencing the raw input message.checked 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.checked 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.checked 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.checked 4 Oct 2026
- Not included
- The library does not build email messages; the project points to the separate mail-builder crate for that functionality.checked 9 Oct 2026
- Optional features
- No Cargo feature is enabled by default; the optional serde feature adds serialization support for Message and related types.checked 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.checked 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.checked 9 Oct 2026
- Performance design
- It uses SIMD kernels on supported targets and defers transfer decoding and charset conversion until content is read.checked 4 Oct 2026
- Production use
- The README says mail-parser is used in production environments worldwide by Stalwart Mail Server.checked 4 Oct 2026
- Robust parsing
- The library aims to parse non-conformant email messages when they do not deviate too far from the standard.checked 4 Oct 2026
- Rust requirement
- The minimum supported Rust version is 1.98.checked 4 Oct 2026
- Security testing
- The project says every library function has been fuzzed and tested with MIRI.checked 4 Oct 2026
- Testing and security
- The project says every library function has been fuzzed and thoroughly tested with MIRI.checked 9 Oct 2026
- What it does
- mail-parser is a Rust library for parsing email messages and conforms to RFC 5322 and MIME RFCs 2045–2049.checked 9 Oct 2026
The full review of Stalwart mail-parser
Stalwart mail-parser is a Rust library for reading email messages and their MIME contents. It suits developers building Rust software that needs to inspect incoming mail; it is a poor fit when the job is to compose messages or use a hosted parsing service.
Overview
The library handles Internet Message Format, MIME and related messaging standards, while trying to recover messages that are imperfect but still close enough to those standards. Its useful distinction is control: parsing stays inside a Rust application, with message parts and content exposed for the application to process.
That focus also defines its boundary. mail-parser reads messages; it does not create them. The project points to the separate mail-builder crate for message construction.
Key features
MIME content and attachments
Parsing produces a MIME tree plus lists of text bodies, HTML bodies and attachments. When one text format is absent, the library can convert HTML to plain text or plain text to HTML. That gives applications a practical fallback for displaying a message, though the conversion does not replace a message-building workflow.
Parsing, speed and memory
The parser aims to tolerate non-conforming messages when they do not stray too far from the standard. SIMD kernels accelerate boundary and header scanning on supported targets, and transfer decoding and charset conversion are deferred until content is read. This design can avoid doing work for content an application never consumes. The README says practically all returned strings reference the raw input message, a useful memory characteristic for applications retaining parsed data alongside the original message.
Charsets, limits and integration
It recognizes 41 character sets using WHATWG encoding labels. The optional full_encoding feature adds legacy multibyte support, including Shift_JIS, Big5 and GB18030. No Cargo features are enabled by default; the optional serde feature adds serialization for Message and related types.
Default limits allow nesting to 64 levels, up to 10,000 MIME parts and up to three levels of decoded nested messages. Those caps provide concrete boundaries for parsing complex input. The project says every library function has been fuzzed and tested with MIRI, and that Stalwart Mail Server uses the library in production. Neither claim removes the need for an application to handle its own parsing failures and input policy.
Pricing
Both named plans cost nothing: Open-source library and mail-parser. The library is free and open source under either the MIT License or Apache License 2.0, at the user's option; there is no paid plan or usage limit stated on the repository page. There is no free trial because the software is already free. These are library plans, not hosted-service tiers with monthly email quotas.
Platforms
Stalwart mail-parser is listed for Linux, macOS and self-hosted use. It requires Rust 1.98 or later, so projects on older toolchains cannot adopt it without upgrading. The minimum Rust version and its library form make it a developer dependency rather than a ready-to-use mail service.
Who it's for
Choose it for Rust applications that need standards-aware parsing, MIME body and attachment access, and control over when content is decoded. Its permissive dual-license choice and lack of stated usage limits make it a straightforward option to evaluate for self-hosted software. Look elsewhere if you need to build outbound email, run parsing through a web or API service, or support a Rust toolchain below 1.98.
Pros and cons
- Pros: MIME tree, text and HTML body lists, and attachment parsing cover the main components of incoming email.
- Pros: Lazy decoding and input-referencing strings can reduce unnecessary work and memory duplication.
- Pros: Fuzzing and MIRI testing across library functions, plus production use in Stalwart Mail Server, are meaningful engineering signals.
- Cons: It does not build messages, so applications that send mail need another crate.
- Cons: Legacy multibyte charset support requires opting into full_encoding; features are not enabled by default.
- Cons: Rust 1.98 is a firm prerequisite, limiting adoption in projects pinned to an older compiler.
Alternatives
Email Parsing Software is the broader category directory for comparing other options.
- PHP MIME Mail Parser is the closer choice for a PHP application: it is a free, MIT-licensed open-source library for PHP 8.2+ and requires the mailparse extension.
- CloudMailin fits teams seeking a hosted API or web service rather than a Rust dependency. Its free tier includes 10,000 emails per month with a 512KB per-message cap; Starter is $25 a month for 10,000 emails per month and 2MB per message.
- MailFrame is another API/web option, with a free tier of 100 parse operations per month and one active schema, or an Indie plan at $19 a month.
- noima offers API and web parsing with a free allowance of 10 documents once and 30 days' retention; its Starter plan is €12 a month for 150 documents per month and 60 days' retention.
- Parserr is an API/web alternative whose free tier covers 15 emails per month, 10 documents per month and one inbox, with parsing rules and integrations included.
- Parsio Receipt OCR is an API/web alternative with a free tier of 30 credits per month, 30-day data retention and one user.
- Parsli is an API/web alternative with 10 free pages on signup, unlimited parsers and API access plus integrations.
- DigiParser is an API/web alternative with a free tier described as 100 documents.
Verdict
For developers building Rust software that must parse incoming email locally, Stalwart mail-parser is a strong, focused choice: it combines MIME and attachment access with lazy decoding and no stated usage caps, at no cost. Choose something else if you need message composition, a hosted parsing workflow, or compatibility with a Rust compiler earlier than 1.98.
Getting started
- Visit the project website on GitHub.
- Use the library in a Rust environment with Rust 1.98 or later.
- Enable optional features such as serde or full_encoding if needed.
Limits worth knowing
Default parser limits are a nesting depth of 64, up to 10,000 MIME parts, and three levels of transfer-encoded nested messages. No Cargo feature is enabled by default.
Questions
Is Stalwart mail-parser free?
Yes. The listed plans are free at 0.00 USD, and the library is open source under MIT or Apache-2.0.
What does it parse?
It supports Internet Message Format, MIME, and other internet messaging RFCs, and exposes a MIME tree, body lists, and attachments.
Does it build email messages?
No. It is a parser; the project points to the separate mail-builder crate for message building.
What platforms are listed?
Linux, macOS, and self-hosted.
What are its default parser limits?
Defaults include nesting depth of 64, up to 10,000 MIME parts, and up to three levels of transfer-encoded nested messages.
What Rust version does it require?
The minimum supported Rust version is 1.98.
Alternatives to Stalwart mail-parser
- 1

DigiParser
Free planAndroidiOSWebAPI7.9Free plan - 2

Parseur
Free planWebAPI7.6From $49 a month - 3

MailFrame
Free planWebAPI7.3From $19 a month - 4

Email Parser
WebAPIWindows7.0From $145 a year - 5

CloudMailin
Free planWebAPI6.8From $25 a month - 6

Parsio Receipt OCR
Free planWebAPI6.8From $24 a month
