0

我创建了这个代码(从 gmail 向 gmail 发送电子邮件):

   use MIME::Lite;
   use Net::SMTP::SSL;
 my $smtps = Net::SMTP::SSL->new ("www.gmail.com", Port=> 465);
  $msg = MIME::Lite->new(
             From     =>'testeotest1234@gmail.com',
             To       =>'xxx',
     #        Cc       =>'some@other.com, some@more.com',
             Encoding => 'base64',
             Subject  =>'Helloooooo, nurse!',
             Data     =>"How's it goin', eh?"
             );

  MIME::Lite->send('smtp','smtp.gmail.com', Port=> 465, Debug=>1, Hello =>'www.gmail.com',AuthUser=>'testeotest1234', AuthPass=>'xxx');

$msg->send();

但我收到此错误:

Port=> 465MIME::Lite::SMTP>>> MIME::Lite::SMTP
MIME::Lite::SMTP>>>   Net::SMTP(2.31)
MIME::Lite::SMTP>>>     Net::Cmd(2.29)
MIME::Lite::SMTP>>>       Exporter(5.65)
MIME::Lite::SMTP>>>     IO::Socket::INET(1.31)
MIME::Lite::SMTP>>>       IO::Socket(1.32)
MIME::Lite::SMTP>>>         IO::Handle(1.31)
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 220 mx.google.com ESMTP kn18sm4777324veb.5 -
 gsmtp
MIME::Lite::SMTP=GLOB(0x244c0d4)>>> EHLO www.gmail.com
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 250-mx.google.com at your service, [12.226.1
28.130]
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 250-SIZE 35882577
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 250-8BITMIME
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 250-STARTTLS
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 250-ENHANCEDSTATUSCODES
MIME::Lite::SMTP=GLOB(0x244c0d4)<<< 250 PIPELINING
SMTP auth() command not supported on smtp.gmail.com

我尝试使用 mail::sender:easy (无法安装,尝试时出现错误),我尝试使用 SSL 行之前创建连接(由于 gmail 连接的工作方式,但无济于事

4

1 回答 1

1

尝试Email::Sender使用Email::Simple. 它们是相对较新的模块,并且比大多数其他模块要好得多。

于 2013-01-31T16:18:51.847 回答