使用mime :: lite perl创建电子邮件(从gmail到gmail)时出错

时间:2013-01-31 15:13:23

标签: perl gmail

我创建了这段代码(从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连接如何工作,但无济于事

1 个答案:

答案 0 :(得分:1)

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