fixup! add mail-from option

move variable declaration closer to usage
This commit is contained in:
Richard Hansen 2024-12-19 19:33:27 -05:00 committed by Indrajit Raychaudhuri
parent d1f81dc9e4
commit d2b1a4dfa6

View file

@ -2401,12 +2401,12 @@ sub logger {
} }
sub sendmail { sub sendmail {
my $recipients = opt('mail'); my $recipients = opt('mail');
my $sender = opt('mail-from') // '';
if (opt('mail-failure') && ($result ne 'OK' && $result ne '0')) { if (opt('mail-failure') && ($result ne 'OK' && $result ne '0')) {
$recipients = opt('mail-failure'); $recipients = opt('mail-failure');
} }
if ($emailbody && $recipients && $emailbody ne $last_emailbody) { if ($emailbody && $recipients && $emailbody ne $last_emailbody) {
my $sender = opt('mail-from') // '';
pipecmd("sendmail -oi $recipients", pipecmd("sendmail -oi $recipients",
"To: $recipients", "To: $recipients",
$sender ne '' ? ("From: $sender") : (), $sender ne '' ? ("From: $sender") : (),