Use specified port when testing SMTP conf

When saving the configuration in the manager, the SMTP test would fail
if your SMTP server is not on the standard port 25

The test now takes the port into account
environments/ppa-mbqj77/deployments/680^2
Maxime Besson 6 years ago committed by Clément OUDOT
parent bc100d059e
commit 01724a95d0
  1. 6
      lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Tests.pm

@ -325,7 +325,11 @@ sub tests {
if ($@);
# Create SMTP object
my $smtp = Net::SMTP->new( $conf->{SMTPServer}, Timeout => 5 );
my $smtp = Net::SMTP->new(
$conf->{SMTPServer},
Timeout => 5,
( $conf->{SMTPPort} ? ( Port => $conf->{SMTPPort} ) : () ),
);
return ( 1,
"SMTP connection to " . $conf->{SMTPServer} . " failed" )
unless ($smtp);

Loading…
Cancel
Save