daaki-message
An RFC 5322 email message parser and builder.
Highlights
- Parse and build — turn raw bytes into structured data, or structured data into raw bytes.
- Full MIME support — multipart messages, attachments, Content-Transfer-Encoding, boundary handling.
- Encoded words — RFC 2047 decoding and encoding for non-ASCII headers.
- Internationalized headers — RFC 6532 UTF-8 support.
- Zero unsafe code — enforced by
#![deny(unsafe_code)]crate-wide. - No runtime dependency — works with any async runtime or without one.
Quick Start
[]
= "0.1"
Parsing
Parse a raw email into its structured parts:
use parse_email;
let raw = b"From: alice@example.com\r\n\
To: bob@example.com\r\n\
Subject: Hi\r\n\
\r\n\
Hello!";
let email = parse_email.unwrap;
assert_eq!;
assert_eq!;
Building
Construct a well-formed RFC 5322 message from typed inputs:
use ;
let email = OutgoingEmail ;
let built = build_message.unwrap;
// built.rfc5322_message — the raw bytes, ready to send
// built.envelope_recipients — the addresses for the SMTP envelope
Standards
| Standard | Coverage |
|---|---|
| RFC 5322 | Internet Message Format — headers, date-time, address parsing |
| RFC 2045–2047 | MIME — body format, media types, encoded words |
| RFC 2183 | Content-Disposition — attachment handling |
| RFC 2231 | MIME parameter encoding — charset and continuation |
| RFC 2392 | Content-ID |
| RFC 6532 | Internationalized email headers |
License
The contents of this package are licensed under the terms of the MIT license.