sub smtp_login { use Net::SMTP_auth; my($host, $port, $helo, $mech, $account, $password) = @_; $smtp = Net::SMTP_auth->new( Host => $host, Port => $port, Hello => $helo, Timeout => 60 ); $result = $smtp->auth($mech, $account, $password); $smtp->quit; return($result); }