Add config option for real name part of from address

https://github.com/webmin/webmin/issues/2600
This commit is contained in:
Jamie Cameron
2025-12-13 10:17:49 -08:00
parent 50075dd71d
commit 018ad0062b
2 changed files with 10 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ spam_report=Report spam using,1,sa_learn-<tt>sa&#45;learn --spam</tt>,spamassass
line3.5=From address options,11
from_addr=<tt>From:</tt> address to use when sending email manually,3,From mailbox username
webmin_from=<tt>From:</tt> address to use when Webmin sends email,3,Default (<tt>webmin-noreply@<i>yourhost</i></tt>)
webmin_from_name=Real name to use in From: address,3,None
from_virtualmin=Get <tt>From:</tt> address from Virtualmin?,1,1-Yes,0-No
from_dom=Domain to use in <tt>From:</tt> address,3,System hostname
no_orig_ip=Include browser IP in <tt>X-Originating</tt>-IP header?,1,0-Yes,1-No

View File

@@ -600,16 +600,21 @@ return &ui_link("list_mail.cgi?user=$_[0]&folder=$_[1]->{'index'}",$text{'mail_r
# Returns the address to use when sending email from a script
sub get_from_address
{
local $host = &get_from_domain();
my $host = &get_from_domain();
my $rv;
if ($config{'webmin_from'} =~ /\@/) {
return $config{'webmin_from'};
$rv = $config{'webmin_from'};
}
elsif (!$config{'webmin_from'}) {
return "webmin-noreply\@$host";
$rv = "webmin-noreply\@$host";
}
else {
return "$config{'webmin_from'}\@$host";
$rv = "$config{'webmin_from'}\@$host";
}
if ($config{'webmin_from_name'}) {
$rv = "\"$config{'webmin_from_name'}\" <$rv>";
}
return $rv;
}
# get_from_domain()