From ad4e94255602fa2a148a61e0416370106b716628 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Thu, 17 Nov 2022 12:55:02 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E2=80=94=20Use=20To=20header=20?= =?UTF-8?q?for=20sending=20mails=20=E2=80=94=20Fix=20#278?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Lufi/Controller/Mail.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Lufi/Controller/Mail.pm b/lib/Lufi/Controller/Mail.pm index 595fdd8..ff8c8b3 100644 --- a/lib/Lufi/Controller/Mail.pm +++ b/lib/Lufi/Controller/Mail.pm @@ -75,6 +75,8 @@ sub send_mail { for my $email (@a) { if (!Email::Valid->address($email)) { push @bad, $email; + } else { + push @good, $email; } } @@ -99,12 +101,14 @@ sub send_mail { ) } - $c->mail( - from => $c->config('mail_sender'), - bcc => $emails, - subject => $subject, - data => $body - ); + for my $email (@good) { + $c->mail( + from => $c->config('mail_sender'), + to => $emails, + subject => $subject, + data => $body + ); + } return $c->render( template => 'msg',