mailio_mime_render (mailio v0.2.0)

MIME / RFC 5322 rendering (pure, total).

Serializes a structured part into RFC 5322 bytes. Used for outbound submission (building messages from drafts) and as the inverse side of the parser for round-trip property tests. Produces CRLF line endings.

Summary

Functions

Build a simple outbound message. Supports a plain-text body, an optional HTML alternative, and arbitrary extra headers. Non-ASCII header values are RFC 2047 encoded.

Encode an unstructured header value, RFC 2047 B-encoding it when it contains non-ASCII bytes.

Render a part map to bytes. The part may be a leaf (body key) or a container (parts key). Recognized fields: type, subtype, params, encoding, charset, headers (extra non-content headers), disposition, filename.

Functions

build(Spec)

-spec build(map()) -> binary().

Build a simple outbound message. Supports a plain-text body, an optional HTML alternative, and arbitrary extra headers. Non-ASCII header values are RFC 2047 encoded.

encode_unstructured(Value)

-spec encode_unstructured(binary()) -> binary().

Encode an unstructured header value, RFC 2047 B-encoding it when it contains non-ASCII bytes.

format_address(Addr)

-spec format_address(mailio_rfc5322:address()) -> binary().

format_addresses(Addrs)

-spec format_addresses([mailio_rfc5322:address()]) -> binary().

render(Part0)

-spec render(map()) -> binary().

Render a part map to bytes. The part may be a leaf (body key) or a container (parts key). Recognized fields: type, subtype, params, encoding, charset, headers (extra non-content headers), disposition, filename.