From 35d0aba9e698584cdb9dd204832fe2948df51715 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 12 Oct 2021 07:38:55 -0400 Subject: [PATCH] Adding a message_id to emails. Fixes #1807 (#1826) --- Cargo.lock | 1 + crates/utils/Cargo.toml | 1 + crates/utils/src/email.rs | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 8dff7b271..d8204367a 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 9671b885c..1a9d9465e 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 77f83d020..eb5e0d1c5 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(