]> Untitled Git - lemmy.git/commitdiff
Adding a message_id to emails. Fixes #1807 (#1826)
authorDessalines <dessalines@users.noreply.github.com>
Tue, 12 Oct 2021 11:38:55 +0000 (07:38 -0400)
committerGitHub <noreply@github.com>
Tue, 12 Oct 2021 11:38:55 +0000 (11:38 +0000)
Cargo.lock
crates/utils/Cargo.toml
crates/utils/src/email.rs

index 8dff7b2714d5b2b4b3c5fc8df48ba180a0c41ecc..d8204367a481ed92b220409e7c8e96afd3f4b0d1 100644 (file)
@@ -2004,6 +2004,7 @@ dependencies = [
  "thiserror",
  "tokio",
  "url",
+ "uuid",
  "webpage",
 ]
 
index 9671b885ce5b058a9c610963c87a005604b6bc34..1a9d9465ecac4b4534edb38427262a03623f7d07 100644 (file)
@@ -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"] }
index 77f83d020bcec4ae788c377664a1dc2a604f6b1b..eb5e0d1c50c32193615410b700e982bd7514514b 100644 (file)
@@ -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(