email-message-wire 0.8.0

RFC822/MIME wire parsing and rendering for email-message
Documentation

email-message-wire

crates.io docs.rs

RFC822 and MIME parsing and rendering for email-message.

This crate has no optional feature flags.

Quick Start

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 rendered = render_rfc822(&message)?;

    assert!(!rendered.is_empty());
    Ok(())
}

Scope Contract

  • Parses RFC822 messages into the typed email_message::Message model.
  • Renders typed messages as RFC822 and MIME wire data.
  • Handles MIME structure, attachment encoding, RFC2047 encoded words, and related transport-safe formatting.
  • Enables email-message's mime feature because full MIME-tree rendering requires MimePart.

Key Behaviors

  • render_rfc822 strips Bcc by default so messages are safe for SMTP or raw delivery.
  • render_rfc822_with and RenderOptions allow intentional non-default policies such as retaining Bcc.
  • MIME attachments are base64-encoded and wrapped to RFC-compliant line lengths.
  • Typed Date and Message-ID values round trip through the public Message API.
  • Attachment references must be resolved to bytes before rendering.

License

Licensed under either of

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.