From: Dessalines Date: Tue, 12 Oct 2021 11:38:55 +0000 (-0400) Subject: Adding a message_id to emails. Fixes #1807 (#1826) X-Git-Url: http://these/git/%22https:/join-lemmy.org/%7BpictshareAvatarThumbnail%28node.comment.creator_avatar%29%7D?a=commitdiff_plain;h=35d0aba9e698584cdb9dd204832fe2948df51715;p=lemmy.git Adding a message_id to emails. Fixes #1807 (#1826) --- diff --git a/Cargo.lock b/Cargo.lock index 8dff7b27..d8204367 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2004,6 +2004,7 @@ dependencies = [ "thiserror", "tokio", "url", + "uuid", "webpage", ] diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index 9671b885..1a9d9465 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -40,3 +40,4 @@ smart-default = "0.6.0" webpage = { version = "1.3.0", default-features = false, features = ["serde"] } jsonwebtoken = "7.2.0" doku = "0.10.1" +uuid = { version = "0.8.2", features = ["serde", "v4"] } diff --git a/crates/utils/src/email.rs b/crates/utils/src/email.rs index 77f83d02..eb5e0d1c 100644 --- a/crates/utils/src/email.rs +++ b/crates/utils/src/email.rs @@ -12,6 +12,7 @@ use lettre::{ Transport, }; use std::str::FromStr; +use uuid::Uuid; pub fn send_email( subject: &str, @@ -44,6 +45,7 @@ pub fn send_email( Some(to_username.to_string()), Address::from_str(to_email).expect("email to address isn't valid"), )) + .message_id(Some(format!("{}@{}", Uuid::new_v4(), settings.hostname))) .subject(subject) .multipart( MultiPart::mixed().multipart(