Properly respect the global notification address

This commit is contained in:
Jamie Cameron
2025-10-26 21:32:47 -07:00
parent 5d67cdb7c1
commit e0e5ef65f8
4 changed files with 14 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ use strict;
use warnings;
no warnings 'redefine';
no warnings 'uninitialized';
our (%text, %config, $no_acl_check);
our (%text, %config, $no_acl_check, %gconfig);
$no_acl_check++;
require './backup-config-lib.pl';
&foreign_require("mailboxes", "mailboxes-lib.pl");
@@ -76,11 +76,10 @@ if (($err || $backup->{'emode'} == 0) && $backup->{'email'}) {
$postmsg;
$subject = &text('email_sok', $host);
}
&mailboxes::send_text_mail($config{'from_addr'} ||
&mailboxes::get_from_address(),
$backup->{'email'},
undef,
$subject,
$msg);
&mailboxes::send_text_mail(
$config{'from_addr'} || &mailboxes::get_from_address(),
$backup->{'email'} eq '*' ? $gconfig{'webmin_email_to'}
: $backup->{'email'},
undef, $subject, $msg);
}

View File

@@ -10,10 +10,11 @@ our (%in, %text, %gconfig);
&ReadParse();
my $backup;
my $wet = $gconfig{'webmin_email_to'};
if ($in{'new'}) {
&ui_print_header(undef, $text{'edit_title1'}, "");
$backup = { 'emode' => 0,
'email' => $gconfig{'webmin_email_to'},
'email' => $wet ? '*' : undef,
'sched' => 1,
'configfile' => 1,
'nofiles' => 0,
@@ -74,7 +75,10 @@ print &ui_hidden_table_start($text{'edit_header3'}, "width=100%", 2,
# Show email address
print &ui_table_row($text{'edit_email'},
&ui_textbox("email", $backup->{'email'}, 40));
$wet ? &ui_opt_textbox("email",
$backup->{'email'} eq '*' ? undef : $backup->{'email'},
40, &text('edit_email_def', "<tt>$wet</tt>"))
: &ui_textbox("email", $backup->{'email'}, 40));
# Show email mode
print &ui_table_row($text{'edit_emode'},

View File

@@ -27,6 +27,7 @@ edit_header=Scheduled backup options
edit_header2=Pre and post backup commands
edit_header3=Backup schedule
edit_email=Email result to address
edit_email_def=Webmin default ($1)
edit_emode=When to send email
edit_emode0=Always
edit_emode1=Only when an error occurs

View File

@@ -36,7 +36,7 @@ else {
$backup->{'dest'} = &parse_backup_destination("dest", \%in);
&cron::parse_times_input($backup, \%in);
$backup->{'emode'} = $in{'emode'};
$backup->{'email'} = $in{'email'};
$backup->{'email'} = $in{'email_def'} ? '*' : $in{'email'};
$backup->{'pre'} = $in{'pre'};
$backup->{'post'} = $in{'post'};
$backup->{'sched'} = $in{'sched'};