From 29e6285e3c632e3dac091b0170c5ce307a589e95 Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 6 Aug 2024 22:26:06 +0200 Subject: [PATCH] ignore empty lines in debug_emails.txt --- src/email.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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> {