From 92b90a81708cf3b8a41e7584b8f9c5c864046dea Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 18 Aug 2025 16:31:47 -0700 Subject: [PATCH] Allow send_text_mail to take SMTP user and pass params https://github.com/webmin/webmin/discussions/2530 --- mailboxes/boxes-lib.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mailboxes/boxes-lib.pl b/mailboxes/boxes-lib.pl index f07697abe..03a64433b 100755 --- a/mailboxes/boxes-lib.pl +++ b/mailboxes/boxes-lib.pl @@ -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])