From cc0ab1bc8a62aabc4dc34b4514b0a3d5a51c580d Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 13 Oct 2024 19:20:39 -0700 Subject: [PATCH] Respect global default destination address if set --- status/edit_sched.cgi | 5 ++++- status/lang/en | 1 + status/monitor.pl | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/status/edit_sched.cgi b/status/edit_sched.cgi index b0f57e50f..350e49edb 100755 --- a/status/edit_sched.cgi +++ b/status/edit_sched.cgi @@ -51,9 +51,12 @@ print &ui_table_row($text{'sched_warn'}, [ 2, $text{'sched_warn2'} ] ]), 3); # Send email to +$defmsg = $gconfig{'webmin_email_to'} ? + &text('sched_email_def', "$gconfig{'webmin_email_to'}") : + $text{'sched_none'}; print &ui_table_row($text{'sched_email'}, &ui_opt_textbox("email", $config{'sched_email'}, 30, - $text{'sched_none'}, $text{'sched_email'}), 3); + $defmsg, $text{'sched_email'}), 3); # From: address print &ui_table_row($text{'sched_from'}, diff --git a/status/lang/en b/status/lang/en index b5b60c1ee..09da38a13 100644 --- a/status/lang/en +++ b/status/lang/en @@ -151,6 +151,7 @@ sched_title=Scheduled Monitoring sched_header=Scheduled background monitoring options sched_mode=Scheduled checking enabled? sched_email=Email status report to +sched_email_def=System default ($1) sched_pager=Page status report to number sched_none=Don't send email sched_pnone=Don't send pages diff --git a/status/monitor.pl b/status/monitor.pl index 326e5f4a3..4984b0668 100755 --- a/status/monitor.pl +++ b/status/monitor.pl @@ -220,9 +220,12 @@ foreach $serv (@services) { $email .= $thisemail; if ($config{'sched_single'} && $email) { # Force the sending of one email and page per report - &send_status_email($email, - $config{'subject_mode'} ? $subj : &text('monitor_sub', $subj), - $config{'sched_email'}); + &send_status_email( + $email, + $config{'subject_mode'} ? $subj : + &text('monitor_sub', $subj), + $config{'sched_email'} || + $gconfig{'webmin_email_to'}); undef($email); if ($pager_msg) { &send_status_pager($pager_msg); @@ -274,11 +277,12 @@ foreach $serv (@services) { # Send the email and page with all messages, if necessary if ($ecount && !$config{'sched_single'}) { - &send_status_email($email, - $config{'subject_mode'} ? $text{'monitor_sub2'} : - $ecount == 1 ? &text('monitor_sub', $subj) : - &text('monitor_sub3', $ecount), - $config{'sched_email'}); + &send_status_email( + $email, + $config{'subject_mode'} ? $text{'monitor_sub2'} : + $ecount == 1 ? &text('monitor_sub', $subj) : + &text('monitor_sub3', $ecount), + $config{'sched_email'} || $gconfig{'webmin_email_to'}); } if ($pager_msg && !$config{'sched_single'}) { &send_status_pager($pager_msg);