parse (message/part.rs)

himalaya · src/shared/message/part.rs · rust · Apache-2.0
email

Parses raw email messages into structured parts, enforcing depth and size limits.

// Source: https://github.com/pimalaya/himalaya | License: Apache-2.0 | Copyright 2022-2026 soywod <pimalaya.org@posteo.net>
// Provided via justclaw.it.com; keep this notice with the code.
//! # Message parts
//!
//! The one walk over a message's MIME parts that `message read`,
//! `attachment list` and `attachment download` share, so a part id
//! names the same part in all of them, plus what each command reads
//! off a part: its type, role, name, `Content-ID` and decoded bytes.
//!
//! A message is parsed once through [`parse`], which also refuses a
//! message too complex to be read whole.

use std::borrow::Cow;

use anyhow::{Result, bail};
use mail_parser::{
    Encoding, HeaderValue, Message, MessageParser, MessagePart, MimeHeaders, PartType,
    parsers::MessageStream,
};
use schem

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key