Allow send_text_mail to take SMTP user and pass params

https://github.com/webmin/webmin/discussions/2530
This commit is contained in:
Jamie Cameron
2025-08-18 16:31:47 -07:00
parent 783ad6f3a2
commit 92b90a8170

View File

@@ -2906,11 +2906,12 @@ if ($@) {
return $rv;
}
# send_text_mail(from, to, cc, subject, body, [smtp-server])
# send_text_mail(from, to, cc, subject, body, [smtp-server],
# [smtp-user, smtp-pass])
# A convenience function for sending a email with just a text body
sub send_text_mail
{
local ($from, $to, $cc, $subject, $body, $smtp) = @_;
local ($from, $to, $cc, $subject, $body, $smtp, $user, $pass) = @_;
local $cs = &get_charset();
local $attach =
{ 'headers' => [ [ 'Content-Type', 'text/plain; charset='.$cs ],
@@ -2922,7 +2923,7 @@ local $mail = { 'headers' =>
[ 'Cc', $cc ],
[ 'Subject', &encode_mimewords($subject) ] ],
'attach' => [ $attach ] };
return &send_mail($mail, undef, 1, 0, $smtp);
return &send_mail($mail, undef, 1, 0, $smtp, $user, $pass);
}
# make_from_line(address, [time])