C12.2: read and write MIME by the tree

The reader walks the MIME tree with its container context: alternative
picks versions, related finds its root by start, attached multiparts
stay whole, digest children are messages. Nesting deeper than 64
levels, counting enclosed messages, is refused, and over-deep parse
results are taken apart iteratively so dropping them cannot overflow
the stack. Composite parts with a Content-ID are cid targets.

The writer keeps attachment parameters and Content-IDs, writes
multipart and message attachments unencoded, and makes its own
Message-ID. SMTP adds BODY=8BITMIME for 8-bit bodies and SMTPUTF8
when any header block at any depth is 8-bit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-19 17:35:05 -04:00
1 parent 9f47b94714
commit fe90221c11
23 files changed
+1672 -136

No files matched your search

Generated
+31
View File
@@ -2135,8 +2135,11 @@ version = "0.1.8"
dependencies = [
"base64 0.23.1",
"ely-platform",
"getrandom 0.4.3",
"imap-proto",
"log",
"mail-builder",
"mail-parser",
"mail-send",
"nom 8.0.0",
"rcgen",
@@ -3595,6 +3598,18 @@ dependencies = [
"foldhash 0.2.0",
]
[[package]]
name = "hashify"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd1246c0e5493286aeb2dde35b1f4eb9c4ce00e628641210a5e553fc001a1f26"
dependencies = [
"indexmap",
"proc-macro2",
"quote",
"syn 2.0.119",
]
[[package]]
name = "heapless"
version = "0.9.3"
@@ -4556,6 +4571,22 @@ dependencies = [
"libc",
]
[[package]]
name = "mail-builder"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccbc27cb02a58a311a404769a22f5abf63fe3173b290d80be7c534f9c7023151"
[[package]]
name = "mail-parser"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec00bda90c6e645a54506c630c2820cd6b1890cfd2b0a169b50f74b2b8c7c86"
dependencies = [
"encoding_rs",
"hashify",
]
[[package]]
name = "mail-send"
version = "0.6.2"