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

@@ -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()`