Properly respect the global notification address

This commit is contained in:
Jamie Cameron
2025-10-26 21:44:14 -07:00
parent e0e5ef65f8
commit 1c9e8b5a25
4 changed files with 16 additions and 9 deletions

View File

@ -118,12 +118,14 @@ if ($out && $dump->{'email'} && &foreign_check("mailboxes")) {
# Send the email # Send the email
if (!$ok || !$config{'error_email'}) { if (!$ok || !$config{'error_email'}) {
# Only send email upon failure, or it requested always # Only send email upon failure, or it requested always
&mailboxes::send_text_mail(&mailboxes::get_from_address(), &mailboxes::send_text_mail(
$dump->{'email'}, &mailboxes::get_from_address(),
undef, $dump->{'email'} eq '*' ? $gconfig{'webmin_email_to'}
$subject, : $dump->{'email'},
$data, undef,
$config{'smtp_server'}); $subject,
$data,
$config{'smtp_server'});
} }
} }

View File

@ -6,6 +6,7 @@ require './fsdump-lib.pl';
&foreign_require("cron", "cron-lib.pl"); &foreign_require("cron", "cron-lib.pl");
&ReadParse(); &ReadParse();
$wet = $gconfig{'webmin_email_to'};
if (!$in{'id'}) { if (!$in{'id'}) {
# Adding a new backup of some type # Adding a new backup of some type
$access{'edit'} || &error($text{'dump_ecannot1'}); $access{'edit'} || &error($text{'dump_ecannot1'});
@ -32,7 +33,7 @@ if (!$in{'id'}) {
$dump = { 'dir' => $in{'dir'}, $dump = { 'dir' => $in{'dir'},
'fs' => $fs, 'fs' => $fs,
'rsh' => &has_command("ssh"), 'rsh' => &has_command("ssh"),
'email' => $gconfig{'webmin_email_to'}, 'email' => $wet ? '*' : undef,
$config{'simple_sched'} ? $config{'simple_sched'} ?
( 'special' => 'daily' ) : ( 'special' => 'daily' ) :
( 'mins' => '0', ( 'mins' => '0',
@ -144,7 +145,10 @@ print &ui_table_row(&hlink($text{'edit_enabled'}, "enabled"),
# Email address to send output to # Email address to send output to
print &ui_table_row(&hlink($text{'edit_email'}, "email"), print &ui_table_row(&hlink($text{'edit_email'}, "email"),
&ui_textbox("email", $dump->{'email'}, 30), 3, \@tds); $wet ? &ui_opt_textbox("email",
$dump->{'email'} eq '*' ? undef : $dump->{'email'},
40, &text('edit_email_def', "<tt>$wet</tt>"))
: &ui_textbox("email", $dump->{'email'}, 40));
# Subject line for email message # Subject line for email message
print &ui_table_row(&hlink($text{'edit_subject'}, "subject"), print &ui_table_row(&hlink($text{'edit_subject'}, "subject"),

View File

@ -128,6 +128,7 @@ edit_savenow=Save and Backup Now
edit_createnow=Create and Backup Now edit_createnow=Create and Backup Now
edit_return=backup edit_return=backup
edit_email=Email scheduled output to edit_email=Email scheduled output to
edit_email_def=Webmin default ($1)
edit_subject=Email message subject edit_subject=Email message subject
edit_restore=Restore .. edit_restore=Restore ..
edit_to=$1 to $2 edit_to=$1 to $2

View File

@ -72,7 +72,7 @@ else {
} }
$dump->{'dir'} = $in{'dir'}; $dump->{'dir'} = $in{'dir'};
$dump->{'fs'} = $in{'fs'}; $dump->{'fs'} = $in{'fs'};
$dump->{'email'} = $in{'email'}; $dump->{'email'} = $in{'email_def'} ? '*' : $in{'email'};
$dump->{'subject'} = $in{'subject_def'} ? undef : $in{'subject'}; $dump->{'subject'} = $in{'subject_def'} ? undef : $in{'subject'};
if ($access{'extra'}) { if ($access{'extra'}) {
$dump->{'extra'} = $in{'extra'}; $dump->{'extra'} = $in{'extra'};