Fix default $smtp_client setting if we aren't connecting to the SMTP server on localhost.

This fixes the issue noted on https://github.com/postfixadmin/postfixadmin/discussions/648
This commit is contained in:
Andrew Ruthven authored and Andrew Ruthven committed 2023-08-18 23:23:15 +12:00
1 parent 5c1725aef8
commit c9551cbb32
2 files changed
+13

No files matched your search

+6
View File
@@ -97,3 +97,9 @@ Additional authors:
Add configuration parameter $account_check and $account_name if account_check is set it will add the value of name of the mailbox in front of the email and it is shown as sender,
if no name is specified at the mailbox, the variable friendly-name is placed in front of the email and it is shown as sender otherwise the email will show as sender.
2023-08-18 Andrew Ruthven <andrew@etc.gen.nz>
Minor improvements to the use of Log4Perl
Fix handling of the default $smtp_client setthing of 'localhost'
if we aren't connecting to the SMTP server on localhost.
+7
View File
@@ -571,6 +571,13 @@ sub send_vacation_email {
}
}
# We can't use localhost as the local bind interface if we're trying
# to connect to an SMTP server that isn't on localhost, we won't be
# able to route to that server.
if ($smtp_server ne 'localhost' && $smtp_client eq 'localhost') {
$smtp_client = undef;
};
my $smtp_params = {
host => $smtp_server,
port => $smtp_server_port,