Why do I get “SMTP Failed to connect to mail server:” when I try to send an email to a Gmail account using MIME::Lite?

前端 未结 4 1517
隐瞒了意图╮
隐瞒了意图╮ 2020-12-19 18:30

I have following code to send an email in Perl:

#!/usr/bin/perl

use MIME::Lite;

$to = \'toid@domain.com\';
$cc = \'ccid@domain.com\';
$from = \'fromid@doma         


        
4条回答
  •  情歌与酒
    2020-12-19 18:51

    It can be fixed with Net::SMTP 3.05 (the latest version at CPAN). It supports SMTPS and STARTTLS.
    [ WARNING: see MIME::Lite 3.030 - NET::SMTP with smtps (port 465) ]

    # It should work with Net::SMTP 3.05
    # MIME::Lite will pass SSL=>1 to Net::SMTP constructor
    $msg->send('smtp', "smtp.gmail.com", SSL=>1,
    AuthUser=>"myid@domain.com", AuthPass=>"mypass" );
    

提交回复
热议问题