1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Parses and renders `email-message` values as RFC 822/MIME bytes.
//!
//! Use this crate at wire-format boundaries such as SMTP submission, `.eml`
//! import and export, and MIME processing. The `email-message` crate remains
//! responsible for the provider-independent model and outbound validation.
//!
//! # Quick start
//!
//! ```rust
//! use email_message_wire::{parse_rfc822, render_rfc822};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let raw = b"From: from@example.com\r\nTo: to@example.com\r\n\r\nHello";
//! let message = parse_rfc822(raw)?;
//! let _bytes = render_rfc822(&message)?;
//! # Ok(())
//! # }
//! ```
//!
//! # Rendering support
//!
//! - Structured body rendering for text, html, text+html, and MIME trees.
//! - `Message::attachments` rendered as MIME parts with multipart nesting, base64 transfer
//! encoding, Content-Disposition, and optional Content-ID.
//! - RFC2231 `filename*=` parameter emitted for non-ASCII attachment filenames.
//! - Attachment references are model-level values and must be resolved to bytes before
//! rendering.
//!
//! # Cargo features
//!
//! This crate has no optional features, and its default feature set is empty;
//! default and all-feature builds are therefore equivalent. Its required
//! `email-message` dependency always enables that crate's `mime` feature, so
//! [`email_message::MimePart`] is also available when both crates occur in the
//! same dependency graph. Other `email-message` features remain independent.
//!
//! # Platform support
//!
//! This is a `std` crate with no operating-system APIs or target-specific
//! implementation. Parsing and rendering operate entirely on in-memory bytes
//! and support Rust targets that provide the standard library.
//!
//! # Parser semantics
//!
//! See [`parse_rfc822`] for the full decoding contract. Highlights:
//! - Body charsets outside `utf-8`/`us-ascii`/`iso-8859-1`/`latin1` are
//! decoded with `String::from_utf8_lossy`, invalid bytes become
//! `U+FFFD` rather than producing an error.
//! - Encoded words in unsupported charsets pass through as the raw
//! `=?…?=` literal.
//! - Duplicate `To:`/`Cc:`/`Bcc:`/`Reply-To:` lines are merged.
//! - RFC 6532 (SMTPUTF8) inbound is not supported; non-ASCII header
//! lines fail.
//! - The returned `Message` has not been validated for outbound
//! delivery, wrap via `OutboundMessage::new` if you intend to send
//! it through a `Transport`.
pub use ;