email-message
Typed, provider-neutral outbound email messages and addresses.
Quick Start
use ;
Feature Flags
No features are enabled by default.
mime: exposesBody::MimeandMimePart; the MIME value types remain available without this feature.serde: enables serialization for public model types and byte-backed attachments.schemars: enables JSON Schema support for public model types.arbitrary: enablesarbitrary::Arbitraryfor fuzzing and property generation.rfc5322-string-compat: accepts RFC 5322 string address forms in serde and JSON Schema in addition to typed address objects.
See the crate documentation for API and feature semantics and the generated feature graph for activation details.
Scope Contract
- This crate models outbound email content and addresses.
- RFC822 and MIME wire parsing and rendering are provided by
email-message-wire. - Provider-specific limits and operational policies belong to transport crates.
- This crate currently requires
std; its parsing backends and owned parser components are notno_std-ready.
Stability Contract
EmailAddressvalues are normalized throughaddr-specduring parsing.- Address display-name formatting may be canonicalized by
Displayand is not guaranteed to preserve source bytes. - Address and message parse-render round trips preserve semantic values, not raw wire formatting.
- Public enums marked
#[non_exhaustive]may gain variants in minor releases.
Metadata Policy
Put provider-agnostic message semantics and outbound headers in Message. Provider-specific controls belong in transport crates as typed TransportOptions, and new Message fields should have stable meaning across structured and raw delivery.
With serde enabled, Message can be used in queued worker payloads. AttachmentBody::Reference represents large attachments that a worker must resolve to bytes before transport delivery; reference resolution intentionally remains outside this crate.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.