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

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::*;