mail: set message id with own host in outgoing mail

This commit is contained in:
Vincent Breitmoser 2019-07-03 23:46:01 +02:00
parent ab3f4006dd
commit 03b5462744
No known key found for this signature in database
GPG Key ID: 7BD18320DEADFA11
4 changed files with 6 additions and 1 deletions

1
Cargo.lock generated
View File

@ -631,6 +631,7 @@ dependencies = [
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -30,6 +30,7 @@ handlebars = "1.1.0"
num_cpus = "1.0"
ring = "0.13"
base64 = "0.10"
uuid = "0.7"
[dependencies.lettre]
version = "0.9"

View File

@ -6,6 +6,7 @@ use lettre::{Transport as LettreTransport, SendmailTransport, file::FileTranspor
use lettre_email::{Mailbox,EmailBuilder};
use url;
use serde::Serialize;
use uuid::Uuid;
use database::types::Email;
use Result;
@ -136,7 +137,8 @@ impl Service {
.alternative(
html.ok_or(failure::err_msg("Email template failed to render"))?,
txt.ok_or(failure::err_msg("Email template failed to render"))?,
);
)
.message_id(format!("<{}@{}>", Uuid::new_v4(), self.domain));
let email = to.iter().fold(email, |email, to| email.to(to.to_string()));

View File

@ -23,6 +23,7 @@ extern crate handlebars;
extern crate lettre;
extern crate lettre_email;
extern crate tempfile;
extern crate uuid;
#[cfg(test)]
extern crate regex;