generate Message-Id header with uuid and from address domain (#171)

This commit is contained in:
Fancy Cade 2021-07-08 05:49:24 -07:00 committed by GitHub
parent 8e40cc3ddb
commit fadebf0997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,8 +291,11 @@ impl<'m> Msg<'m> {
match h.get_key().to_lowercase().as_str() {
"in-reply-to" => msg.in_reply_to(value.parse().unwrap()),
"from" => match value.parse() {
Ok(addr) => msg.from(addr),
"from" => match value.parse::<lettre::message::Mailbox>() {
Ok(addr) => {
let msg_id = format!("{}@{}", Uuid::new_v4().to_string(), addr.email.domain());
msg.from(addr).message_id(Some(msg_id))
}
Err(_) => msg,
},
"to" => value