diff --git a/src/email.rs b/src/email.rs index c4d540a..ff3da78 100644 --- a/src/email.rs +++ b/src/email.rs @@ -66,7 +66,8 @@ pub struct SimpleEmail { impl SimpleEmail { pub fn new(base: Email, from: &str, to: &str, in_reply_to: Option) -> Self { - let recipients = to.split('\n').map(|s| s.trim().to_string()).filter(|s| !s.is_empty()).collect(); + let recipients = + to.split('\n').map(|s| s.trim().to_string()).filter(|s| !s.is_empty()).collect(); Self { base: base.clone(), from: from.to_string(), to: recipients, in_reply_to } } pub fn send_email(&self, subject: String, body: String) -> Result> { @@ -88,14 +89,14 @@ impl Email { } pub fn send_email( - &self, from: String, to: &[String], subject: String, body: String, in_reply_to: Option, + &self, from: String, to: &[String], subject: String, body: String, + in_reply_to: Option, ) -> Result> { let message_id = Uuid::new_v4().to_string() + &self.message_id_suffix; - let mut email = Message::builder() - .from(from.parse().unwrap()); + let mut email = Message::builder().from(from.parse().unwrap()); for recipient in to { email = email.to(recipient.parse().unwrap()); - }; + } email = email.message_id(Some(message_id.clone())); let email = if in_reply_to.is_some() { email.in_reply_to(in_reply_to.unwrap()) } else { email }