diff --git a/src/email.rs b/src/email.rs index abecef9..c4d540a 100644 --- a/src/email.rs +++ b/src/email.rs @@ -66,7 +66,7 @@ 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.to_string()).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> {