Subject: | Net::SMTP->new() Host array with empty return nothing in host() and fail starttls() |
In Host array of Net::SMTP->new host can not be empty if then called starttls() and produce "Cannot determine peer hostname for verification". host() returns empty too. But if send to array a knowingly false host, then everything works.
Error:
my $smtp_server="";
my $smtp = Net::SMTP->new(
Host => [$smtp_server, "example.com"],
);
$smtp->host(); # empty
$smtp->starttls(); # "Cannot determine peer hostname for verification"
Work:
my $smtp_server="zzz";
my $smtp = Net::SMTP->new(
Host => [$smtp_server, "example.com"],
);
$smtp->host(); # "example.com"
$smtp->starttls(); # work