refactor: use mail-builder instead of lettre_email

This commit is contained in:
link2xt
2025-01-29 22:46:03 +00:00
parent 82ea4e2ae2
commit 67f768fec0
13 changed files with 548 additions and 857 deletions

332
Cargo.lock generated
View File

@@ -207,12 +207,6 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]]
name = "ascii_utils"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a"
[[package]]
name = "asn1-rs"
version = "0.6.2"
@@ -226,7 +220,7 @@ dependencies = [
"num-traits",
"rusticata-macros",
"thiserror 1.0.69",
"time 0.3.37",
"time",
]
[[package]]
@@ -487,10 +481,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
dependencies = [
"futures-core",
"getrandom 0.2.12",
"getrandom",
"instant",
"pin-project-lite",
"rand 0.8.5",
"rand",
"tokio",
]
@@ -515,12 +509,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
[[package]]
name = "base64"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
[[package]]
name = "base64"
version = "0.12.3"
@@ -838,10 +826,8 @@ checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"serde",
"wasm-bindgen",
"windows-targets 0.52.6",
]
@@ -1165,7 +1151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
dependencies = [
"generic-array",
"rand_core 0.6.4",
"rand_core",
"subtle",
"zeroize",
]
@@ -1177,7 +1163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"rand_core 0.6.4",
"rand_core",
"typenum",
]
@@ -1233,7 +1219,7 @@ dependencies = [
"curve25519-dalek-derive",
"digest",
"fiat-crypto",
"rand_core 0.6.4",
"rand_core",
"rustc_version",
"serde",
"subtle",
@@ -1336,7 +1322,6 @@ dependencies = [
"deltachat-contact-tools",
"deltachat-time",
"deltachat_derive",
"email",
"encoded-words",
"escaper",
"fast-socks5",
@@ -1354,9 +1339,9 @@ dependencies = [
"iroh",
"iroh-gossip",
"kamadak-exif",
"lettre_email",
"libc",
"log",
"mail-builder",
"mailparse",
"mime",
"nu-ansi-term",
@@ -1373,7 +1358,7 @@ dependencies = [
"qrcodegen",
"quick-xml",
"quoted_printable",
"rand 0.8.5",
"rand",
"ratelimit",
"regex",
"rusqlite",
@@ -1499,7 +1484,7 @@ dependencies = [
"libc",
"num-traits",
"once_cell",
"rand 0.8.5",
"rand",
"serde_json",
"thiserror 2.0.11",
"tokio",
@@ -1784,7 +1769,7 @@ checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871"
dependencies = [
"curve25519-dalek",
"ed25519",
"rand_core 0.6.4",
"rand_core",
"serde",
"sha2",
"subtle",
@@ -1812,26 +1797,12 @@ dependencies = [
"hkdf",
"pem-rfc7468",
"pkcs8",
"rand_core 0.6.4",
"rand_core",
"sec1",
"subtle",
"zeroize",
]
[[package]]
name = "email"
version = "0.0.20"
source = "git+https://github.com/deltachat/rust-email?branch=master#ba176ca31ae000203368eb9baacc7eb469fd7692"
dependencies = [
"base64 0.11.0",
"chrono",
"encoded-words",
"encoding",
"lazy_static",
"rand 0.7.3",
"version_check",
]
[[package]]
name = "embedded-io"
version = "0.4.0"
@@ -1859,70 +1830,6 @@ dependencies = [
"thiserror 1.0.69",
]
[[package]]
name = "encoding"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
dependencies = [
"encoding-index-japanese",
"encoding-index-korean",
"encoding-index-simpchinese",
"encoding-index-singlebyte",
"encoding-index-tradchinese",
]
[[package]]
name = "encoding-index-japanese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-korean"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-simpchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-singlebyte"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding-index-tradchinese"
version = "1.20141219.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
dependencies = [
"encoding_index_tests",
]
[[package]]
name = "encoding_index_tests"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
[[package]]
name = "encoding_rs"
version = "0.8.35"
@@ -2098,15 +2005,6 @@ dependencies = [
"tokio-stream",
]
[[package]]
name = "fast_chemail"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "495a39d30d624c2caabe6312bfead73e7717692b44e0b32df168c275a2e8e9e4"
dependencies = [
"ascii_utils",
]
[[package]]
name = "fastrand"
version = "2.3.0"
@@ -2139,7 +2037,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"
dependencies = [
"rand_core 0.6.4",
"rand_core",
"subtle",
]
@@ -2395,17 +2293,6 @@ dependencies = [
"zeroize",
]
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.12"
@@ -2415,7 +2302,7 @@ dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasi",
"wasm-bindgen",
]
@@ -2467,7 +2354,7 @@ dependencies = [
"parking_lot",
"portable-atomic",
"quanta",
"rand 0.8.5",
"rand",
"smallvec",
"spinning_top",
]
@@ -2479,7 +2366,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
dependencies = [
"ff",
"rand_core 0.6.4",
"rand_core",
"subtle",
]
@@ -2566,7 +2453,7 @@ dependencies = [
"idna",
"ipnet",
"once_cell",
"rand 0.8.5",
"rand",
"thiserror 2.0.11",
"tinyvec",
"tokio",
@@ -2587,7 +2474,7 @@ dependencies = [
"moka",
"once_cell",
"parking_lot",
"rand 0.8.5",
"rand",
"resolv-conf",
"smallvec",
"thiserror 2.0.11",
@@ -2991,7 +2878,7 @@ dependencies = [
"hyper",
"hyper-util",
"log",
"rand 0.8.5",
"rand",
"tokio",
"url",
"xmltree",
@@ -3117,7 +3004,7 @@ dependencies = [
"pin-project",
"pkarr",
"portmapper",
"rand 0.8.5",
"rand",
"rcgen",
"reqwest",
"ring",
@@ -3149,8 +3036,8 @@ dependencies = [
"data-encoding",
"derive_more",
"ed25519-dalek",
"getrandom 0.2.12",
"rand_core 0.6.4",
"getrandom",
"rand_core",
"serde",
"thiserror 2.0.11",
"url",
@@ -3189,8 +3076,8 @@ dependencies = [
"iroh-blake3",
"iroh-metrics",
"postcard",
"rand 0.8.5",
"rand_core 0.6.4",
"rand",
"rand_core",
"serde",
"serde-error",
"thiserror 2.0.11",
@@ -3236,7 +3123,7 @@ dependencies = [
"n0-future",
"netwatch",
"portmapper",
"rand 0.8.5",
"rand",
"reqwest",
"rustls",
"surge-ping",
@@ -3274,8 +3161,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "929d5d8fa77d5c304d3ee7cae9aede31f13908bd049f9de8c7c0094ad6f7c535"
dependencies = [
"bytes",
"getrandom 0.2.12",
"rand 0.8.5",
"getrandom",
"rand",
"ring",
"rustc-hash",
"rustls",
@@ -3327,7 +3214,7 @@ dependencies = [
"num_enum",
"pin-project",
"postcard",
"rand 0.8.5",
"rand",
"reqwest",
"rustls",
"rustls-webpki",
@@ -3448,30 +3335,6 @@ dependencies = [
"spin",
]
[[package]]
name = "lettre"
version = "0.9.2"
source = "git+https://github.com/deltachat/lettre?branch=master#2ffdb5347f1255b4aed51cf87cda1f8207160f36"
dependencies = [
"fast_chemail",
"log",
]
[[package]]
name = "lettre_email"
version = "0.9.2"
source = "git+https://github.com/deltachat/lettre?branch=master#2ffdb5347f1255b4aed51cf87cda1f8207160f36"
dependencies = [
"base64 0.11.0",
"email",
"lazy_static",
"lettre",
"mime",
"regex",
"time 0.1.45",
"uuid",
]
[[package]]
name = "libc"
version = "0.2.169"
@@ -3581,6 +3444,11 @@ version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9106e1d747ffd48e6be5bb2d97fa706ed25b144fbee4d5c02eae110cd8d6badd"
[[package]]
name = "mail-builder"
version = "0.4.1"
source = "git+https://github.com/stalwartlabs/mail-builder?branch=main#b86e558d54d43c1c1991fbda84109268815abcac"
[[package]]
name = "mailparse"
version = "0.16.0"
@@ -3664,7 +3532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasi",
"windows-sys 0.52.0",
]
@@ -3720,7 +3588,7 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom 0.2.12",
"getrandom",
]
[[package]]
@@ -3860,7 +3728,7 @@ dependencies = [
"serde",
"socket2",
"thiserror 2.0.11",
"time 0.3.37",
"time",
"tokio",
"tokio-util",
"tracing",
@@ -3980,7 +3848,7 @@ dependencies = [
"num-integer",
"num-iter",
"num-traits",
"rand 0.8.5",
"rand",
"serde",
"smallvec",
"zeroize",
@@ -4223,7 +4091,7 @@ dependencies = [
"ecdsa",
"elliptic-curve",
"primeorder",
"rand_core 0.6.4",
"rand_core",
"sha2",
]
@@ -4263,7 +4131,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"
dependencies = [
"base64ct",
"rand_core 0.6.4",
"rand_core",
"subtle",
]
@@ -4353,7 +4221,7 @@ dependencies = [
"aes-gcm",
"aes-kw",
"argon2",
"base64 0.21.7",
"base64 0.22.1",
"bitfield",
"block-padding",
"blowfish",
@@ -4394,7 +4262,7 @@ dependencies = [
"p256",
"p384",
"p521",
"rand 0.8.5",
"rand",
"ripemd",
"rsa",
"sha1",
@@ -4621,12 +4489,12 @@ dependencies = [
"libc",
"netwatch",
"num_enum",
"rand 0.8.5",
"rand",
"serde",
"smallvec",
"socket2",
"thiserror 2.0.11",
"time 0.3.37",
"time",
"tokio",
"tokio-util",
"tracing",
@@ -4797,8 +4665,8 @@ dependencies = [
"bitflags 2.8.0",
"lazy_static",
"num-traits",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rand",
"rand_chacha",
"rand_xorshift",
"regex-syntax 0.8.2",
"unarray",
@@ -4836,7 +4704,7 @@ dependencies = [
"libc",
"once_cell",
"raw-cpuid",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasi",
"web-sys",
"winapi",
]
@@ -4887,8 +4755,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d"
dependencies = [
"bytes",
"getrandom 0.2.12",
"rand 0.8.5",
"getrandom",
"rand",
"ring",
"rustc-hash",
"rustls",
@@ -4949,19 +4817,6 @@ dependencies = [
"nibble_vec",
]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand"
version = "0.8.5"
@@ -4969,18 +4824,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
"rand_chacha",
"rand_core",
]
[[package]]
@@ -4990,16 +4835,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.4",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
"rand_core",
]
[[package]]
@@ -5008,16 +4844,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom 0.2.12",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
"getrandom",
]
[[package]]
@@ -5026,7 +4853,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
dependencies = [
"rand_core 0.6.4",
"rand_core",
]
[[package]]
@@ -5071,7 +4898,7 @@ dependencies = [
"pem",
"ring",
"rustls-pki-types",
"time 0.3.37",
"time",
"yasna",
]
@@ -5099,7 +4926,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
dependencies = [
"getrandom 0.2.12",
"getrandom",
"libredox",
"thiserror 2.0.11",
]
@@ -5224,7 +5051,7 @@ checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24"
dependencies = [
"cc",
"cfg-if",
"getrandom 0.2.12",
"getrandom",
"libc",
"untrusted",
"windows-sys 0.52.0",
@@ -5244,7 +5071,7 @@ dependencies = [
"p256",
"p384",
"pkcs8",
"rand_core 0.6.4",
"rand_core",
"ring",
"signature",
]
@@ -5271,7 +5098,7 @@ dependencies = [
"num-traits",
"pkcs1",
"pkcs8",
"rand_core 0.6.4",
"rand_core",
"signature",
"spki",
"subtle",
@@ -5815,7 +5642,7 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project",
"rand 0.8.5",
"rand",
"sendfd",
"serde",
"serde_json",
@@ -5845,7 +5672,7 @@ dependencies = [
"chacha20poly1305",
"hkdf",
"md-5",
"rand 0.8.5",
"rand",
"ring-compat",
"sha1",
]
@@ -5881,7 +5708,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
dependencies = [
"digest",
"rand_core 0.6.4",
"rand_core",
]
[[package]]
@@ -6054,7 +5881,7 @@ dependencies = [
"precis-core",
"precis-profiles",
"quoted-string-parser",
"rand 0.8.5",
"rand",
]
[[package]]
@@ -6072,7 +5899,7 @@ dependencies = [
"hex",
"parking_lot",
"pnet_packet",
"rand 0.8.5",
"rand",
"socket2",
"thiserror 1.0.69",
"tokio",
@@ -6263,17 +6090,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "time"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "time"
version = "0.3.37"
@@ -6664,7 +6480,7 @@ dependencies = [
"http 1.1.0",
"httparse",
"log",
"rand 0.8.5",
"rand",
"sha1",
"thiserror 1.0.69",
"url",
@@ -6683,7 +6499,7 @@ dependencies = [
"http 1.1.0",
"httparse",
"log",
"rand 0.8.5",
"rand",
"sha1",
"thiserror 1.0.69",
"utf-8",
@@ -6867,7 +6683,7 @@ version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3758f5e68192bb96cc8f9b7e2c2cfdabb435499a28499a42f8f984092adad4b"
dependencies = [
"getrandom 0.2.12",
"getrandom",
"serde",
]
@@ -6908,18 +6724,6 @@ dependencies = [
"try-lock",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -7581,7 +7385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"
dependencies = [
"curve25519-dalek",
"rand_core 0.6.4",
"rand_core",
"serde",
"zeroize",
]
@@ -7600,7 +7404,7 @@ dependencies = [
"oid-registry",
"rusticata-macros",
"thiserror 1.0.69",
"time 0.3.37",
"time",
]
[[package]]
@@ -7641,7 +7445,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd"
dependencies = [
"time 0.3.37",
"time",
]
[[package]]

View File

@@ -50,7 +50,6 @@ brotli = { version = "7", default-features=false, features = ["std"] }
bytes = "1"
chrono = { workspace = true, features = ["alloc", "clock", "std"] }
data-encoding = "2.7.0"
email = { git = "https://github.com/deltachat/rust-email", branch = "master" }
encoded-words = "0.2"
escaper = "0.1"
fast-socks5 = "0.10"
@@ -67,8 +66,8 @@ image = { version = "0.25.5", default-features=false, features = ["gif", "jpeg",
iroh-gossip = { version = "0.32", default-features = false, features = ["net"] }
iroh = { version = "0.32", default-features = false }
kamadak-exif = "0.6.1"
lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" }
libc = { workspace = true }
mail-builder = { git = "https://github.com/stalwartlabs/mail-builder", branch = "main", default-features = false }
mailparse = "0.16"
mime = "0.3.17"
num_cpus = "1.16"

View File

@@ -1,7 +1,5 @@
[advisories]
ignore = [
"RUSTSEC-2020-0071",
# Timing attack on RSA.
# Delta Chat does not use RSA for new keys
# and this requires precise measurement of the decryption time by the attacker.
@@ -9,9 +7,6 @@ ignore = [
# <https://rustsec.org/advisories/RUSTSEC-2023-0071>
"RUSTSEC-2023-0071",
# Unmaintained encoding
"RUSTSEC-2021-0153",
# Unmaintained instant
"RUSTSEC-2024-0384",
@@ -32,16 +27,12 @@ skip = [
{ name = "core-foundation", version = "0.9.4" },
{ name = "event-listener", version = "2.5.3" },
{ name = "generator", version = "0.7.5" },
{ name = "getrandom", version = "<0.2" },
{ name = "http", version = "0.2.12" },
{ name = "loom", version = "0.5.6" },
{ name = "netlink-packet-route", version = "0.17.1" },
{ name = "nix", version = "0.26.4" },
{ name = "nix", version = "0.27.1" },
{ name = "quick-error", version = "<2.0" },
{ name = "rand_chacha", version = "<0.3" },
{ name = "rand_core", version = "<0.6" },
{ name = "rand", version = "<0.8" },
{ name = "redox_syscall", version = "0.3.5" },
{ name = "regex-automata", version = "0.1.10" },
{ name = "regex-syntax", version = "0.6.29" },
@@ -51,11 +42,9 @@ skip = [
{ name = "syn", version = "1.0.109" },
{ name = "thiserror-impl", version = "1.0.69" },
{ name = "thiserror", version = "1.0.69" },
{ name = "time", version = "<0.3" },
{ name = "tokio-tungstenite", version = "0.21.0" },
{ name = "tungstenite", version = "0.21.0" },
{ name = "unicode-width", version = "0.1.11" },
{ name = "wasi", version = "<0.11" },
{ name = "windows" },
{ name = "windows_aarch64_gnullvm" },
{ name = "windows_aarch64_msvc" },
@@ -102,5 +91,5 @@ license-files = [
[sources.allow-org]
# Organisations which we allow git sources from.
github = [
"deltachat",
"stalwartlabs",
]

View File

@@ -3,6 +3,7 @@
use std::cmp;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::io::Cursor;
use std::marker::Sync;
use std::path::{Path, PathBuf};
use std::str::FromStr;
@@ -11,6 +12,7 @@ use std::time::Duration;
use anyhow::{anyhow, bail, ensure, Context as _, Result};
use deltachat_contact_tools::{sanitize_bidi_characters, sanitize_single_line, ContactAddress};
use deltachat_derive::{FromSql, ToSql};
use mail_builder::mime::MimePart;
use serde::{Deserialize, Serialize};
use strum_macros::EnumIter;
use tokio::task;
@@ -32,7 +34,6 @@ use crate::debug_logging::maybe_set_logging_xdc;
use crate::download::DownloadState;
use crate::ephemeral::{start_chat_ephemeral_timers, Timer as EphemeralTimer};
use crate::events::EventType;
use crate::html::new_html_mimepart;
use crate::location;
use crate::log::LogExt;
use crate::message::{self, Message, MessageState, MsgId, Viewtype};
@@ -2157,14 +2158,18 @@ impl Chat {
} else {
None
};
let new_mime_headers = new_mime_headers.map(|s| new_html_mimepart(s).build().as_string());
let new_mime_headers: Option<String> = new_mime_headers.map(|s| {
let html_part = MimePart::new("text/html", s);
let mut buffer = Vec::new();
let cursor = Cursor::new(&mut buffer);
html_part.write_part(cursor).ok();
String::from_utf8_lossy(&buffer).to_string()
});
let new_mime_headers = new_mime_headers.or_else(|| match was_truncated {
// We need to add some headers so that they are stripped before formatting HTML by
// `MsgId::get_html()`, not a part of the actual text. Let's add "Content-Type", it's
// anyway a useful metadata about the stored text.
true => Some(
"Content-Type: text/plain; charset=utf-8\r\n\r\n".to_string() + &msg.text + "\r\n",
),
true => Some("Content-Type: text/plain; charset=utf-8\r\n\r\n".to_string() + &msg.text),
false => None,
});
let new_mime_headers = match new_mime_headers {

View File

@@ -247,7 +247,16 @@ pub async fn make_vcard(context: &Context, contacts: &[ContactId]) -> Result<Str
timestamp: Ok(now),
});
}
Ok(contact_tools::make_vcard(&vcard_contacts))
// XXX: newline at the end of vCard is trimmed
// for compatibility with core <=1.155.3
// Newer core should be able to deal with
// trailing CRLF as the fix
// <https://github.com/deltachat/deltachat-core-rust/pull/6522>
// is merged.
Ok(contact_tools::make_vcard(&vcard_contacts)
.trim_end()
.to_string())
}
/// Imports contacts from the given vCard.

View File

@@ -1,6 +1,9 @@
//! End-to-end encryption support.
use std::io::Cursor;
use anyhow::{format_err, Context as _, Result};
use mail_builder::mime::MimePart;
use num_traits::FromPrimitive;
use crate::aheader::{Aheader, EncryptPreference};
@@ -95,7 +98,7 @@ impl EncryptHelper {
self,
context: &Context,
verified: bool,
mail_to_encrypt: lettre_email::PartBuilder,
mail_to_encrypt: MimePart<'static>,
peerstates: Vec<(Option<Peerstate>, String)>,
compress: bool,
) -> Result<String> {
@@ -136,7 +139,9 @@ impl EncryptHelper {
let sign_key = load_self_secret_key(context).await?;
let raw_message = mail_to_encrypt.build().as_string().into_bytes();
let mut raw_message = Vec::new();
let cursor = Cursor::new(&mut raw_message);
mail_to_encrypt.clone().write_part(cursor).ok();
let ctext = pgp::pk_encrypt(&raw_message, keyring, Some(sign_key), compress).await?;
@@ -145,15 +150,13 @@ impl EncryptHelper {
/// Signs the passed-in `mail` using the private key from `context`.
/// Returns the payload and the signature.
pub async fn sign(
self,
context: &Context,
mail: lettre_email::PartBuilder,
) -> Result<(lettre_email::MimeMessage, String)> {
pub async fn sign(self, context: &Context, mail: &MimePart<'static>) -> Result<String> {
let sign_key = load_self_secret_key(context).await?;
let mime_message = mail.build();
let signature = pgp::pk_calc_signature(mime_message.as_string().as_bytes(), &sign_key)?;
Ok((mime_message, signature))
let mut buffer = Vec::new();
let cursor = Cursor::new(&mut buffer);
mail.clone().write_part(cursor).ok();
let signature = pgp::pk_calc_signature(&buffer, &sign_key)?;
Ok(signature)
}
}

View File

@@ -11,9 +11,8 @@ use std::mem;
use anyhow::{Context as _, Result};
use base64::Engine as _;
use lettre_email::mime::Mime;
use lettre_email::PartBuilder;
use mailparse::ParsedContentType;
use mime::Mime;
use crate::context::Context;
use crate::headerdef::{HeaderDef, HeaderDefMap};
@@ -277,16 +276,6 @@ impl MsgId {
}
}
/// Wraps HTML text into a new text/html mimepart structure.
///
/// Used on forwarding messages to avoid leaking the original mime structure
/// and also to avoid sending too much, maybe large data.
pub fn new_html_mimepart(html: String) -> PartBuilder {
PartBuilder::new()
.content_type(&"text/html; charset=utf-8".parse::<mime::Mime>().unwrap())
.body(html)
}
#[cfg(test)]
mod tests {
use super::*;

File diff suppressed because it is too large Load Diff

View File

@@ -10,8 +10,8 @@ use anyhow::{bail, Context as _, Result};
use deltachat_contact_tools::{addr_cmp, addr_normalize, sanitize_bidi_characters};
use deltachat_derive::{FromSql, ToSql};
use format_flowed::unformat_flowed;
use lettre_email::mime::Mime;
use mailparse::{addrparse_header, DispositionType, MailHeader, MailHeaderMap, SingleInfo};
use mime::Mime;
use crate::aheader::{Aheader, EncryptPreference};
use crate::authres::handle_authres;

View File

@@ -25,7 +25,6 @@
use anyhow::{anyhow, bail, Context as _, Result};
use data_encoding::BASE32_NOPAD;
use email::Header;
use futures_lite::StreamExt;
use iroh::{Endpoint, NodeAddr, NodeId, PublicKey, RelayMap, RelayMode, RelayUrl, SecretKey};
use iroh_gossip::net::{Event, Gossip, GossipEvent, JoinOptions, GOSSIP_ALPN};
@@ -40,7 +39,6 @@ use url::Url;
use crate::chat::send_msg;
use crate::config::Config;
use crate::context::Context;
use crate::headerdef::HeaderDef;
use crate::message::{Message, MsgId, Viewtype};
use crate::mimeparser::SystemMessage;
use crate::EventType;
@@ -496,14 +494,11 @@ fn create_random_topic() -> TopicId {
/// Creates `Iroh-Gossip-Header` with a new random topic
/// and stores the topic for the message.
pub(crate) async fn create_iroh_header(ctx: &Context, msg_id: MsgId) -> Result<Header> {
pub(crate) async fn create_iroh_header(ctx: &Context, msg_id: MsgId) -> Result<String> {
let topic = create_random_topic();
insert_topic_stub(ctx, msg_id, topic).await?;
let topic_string = BASE32_NOPAD.encode(topic.as_bytes()).to_ascii_lowercase();
Ok(Header::new(
HeaderDef::IrohGossipTopic.get_headername().to_string(),
topic_string,
))
Ok(topic_string)
}
async fn subscribe_loop(

View File

@@ -1061,8 +1061,8 @@ async fn test_classic_mailing_list() -> Result<()> {
let mime = sent.payload();
println!("Sent mime message is:\n\n{mime}\n\n");
assert!(mime.contains("Content-Type: text/plain; charset=utf-8\r\n"));
assert!(mime.contains("Subject: =?utf-8?q?Re=3A_=5Bdelta-dev=5D_What=27s_up=3F?=\r\n"));
assert!(mime.contains("Content-Type: text/plain; charset=\"utf-8\"\r\n"));
assert!(mime.contains("Subject: Re: [delta-dev] What's up?\r\n"));
assert!(mime.contains("MIME-Version: 1.0\r\n"));
assert!(mime.contains("In-Reply-To: <38942@posteo.org>\r\n"));
assert!(mime.contains("Chat-Version: 1.0\r\n"));

View File

@@ -1,7 +1,7 @@
//! # Synchronize items between devices.
use anyhow::Result;
use lettre_email::PartBuilder;
use mail_builder::mime::MimePart;
use serde::{Deserialize, Serialize};
use crate::chat::{self, ChatId};
@@ -227,14 +227,8 @@ impl Context {
}
}
pub(crate) fn build_sync_part(&self, json: String) -> PartBuilder {
PartBuilder::new()
.content_type(&"application/json".parse::<mime::Mime>().unwrap())
.header((
"Content-Disposition",
"attachment; filename=\"multi-device-sync.json\"",
))
.body(json)
pub(crate) fn build_sync_part(&self, json: String) -> MimePart<'static> {
MimePart::new("application/json", json).attachment("multi-device-sync.json")
}
/// Takes a JSON string created by `build_sync_json()`

View File

@@ -27,7 +27,7 @@ use anyhow::{anyhow, bail, ensure, format_err, Context as _, Result};
use async_zip::tokio::read::seek::ZipFileReader as SeekZipFileReader;
use deltachat_contact_tools::sanitize_bidi_characters;
use deltachat_derive::FromSql;
use lettre_email::PartBuilder;
use mail_builder::mime::MimePart;
use rusqlite::OptionalExtension;
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -41,7 +41,6 @@ use crate::context::Context;
use crate::events::EventType;
use crate::key::{load_self_public_key, DcKey};
use crate::message::{Message, MessageState, MsgId, Viewtype};
use crate::mimefactory::wrapped_base64_encode;
use crate::mimefactory::RECOMMENDED_FILE_SIZE;
use crate::mimeparser::SystemMessage;
use crate::param::Param;
@@ -651,17 +650,8 @@ impl Context {
}
}
pub(crate) fn build_status_update_part(&self, json: &str) -> PartBuilder {
let encoded_body = wrapped_base64_encode(json.as_bytes());
PartBuilder::new()
.content_type(&"application/json".parse::<mime::Mime>().unwrap())
.header((
"Content-Disposition",
"attachment; filename=\"status-update.json\"",
))
.header(("Content-Transfer-Encoding", "base64"))
.body(encoded_body)
pub(crate) fn build_status_update_part(&self, json: &str) -> MimePart<'static> {
MimePart::new("application/json", json.as_bytes().to_vec()).attachment("status-update.json")
}
/// Receives status updates from receive_imf to the database