为什么我会和QUOT; SMTP无法连接到邮件服务器:"当我尝试发送电子邮件到使用MIME ::精简版Gmail帐户? [英] 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?
问题描述
我有以下code在Perl发送电子邮件:
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@domain.com';
$subject = 'Test Email';
$message = 'This is test email sent by Perl Script';
$msg = MIME::Lite->new(
From => $from,
To => $to,
Cc => $cc,
Subject => $subject,
Data => $message
);
$msg->send;
#$msg->send('smtp', "smtp.gmail.com", AuthUser=>"myid@domain.com", AuthPass=>"mypass" );
#$msg->send('smtp', "smtp.gmail.com", Debug=>0 );
#$msg->send('type',@args);
print "Email Sent Successfully\n";
当我运行它,我得到以下错误:
When I run it I get the following error:
SMTP Failed to connect to mail server:
当我称之为 $ msg->发
与参数(参见下面的注释行),我收到以下错误:
When I call $msg->send
with arguments (see the commented lines above) I get the following error:
SMTP auth() command not supported on smtp.gmail.com
我该如何解决这个问题?
How can I fix this?
推荐答案
有人提起的 bug报告的这个几年前。维护者的回应是:
Somebody filed a bug report for this several years ago. The maintainer's response was:
这是不太可能被固定。
MIME ::精简版不支持的Net :: SMTP :: TLS,我不认为自己实施,在未来。我强烈建议关闭MIME ::精简版的移动像电子邮件发件人::和Email :: MIME或其他多个支持工具的工具。
MIME::Lite does not support Net::SMTP::TLS, and I don't see myself implementing that in the future. I strongly suggest moving off of MIME::Lite to tools like Email::Sender and Email::MIME or other more-supported tools.
请注意,你不应该甚至可以使用 MIME ::精简版
摆在首位,因为的文档建议反对:
Note that you shouldn't even be using MIME::Lite
in the first place, since the documentation recommends against it:
不建议其当前的维护者MIME ::精简版。还有一些备选方案,如电子邮件:: MIME或MIME ::实体和Email ::发件人,您应该使用来代替。 MIME ::精简版继续累积怪异的bug报告,并且不因更好的替代品的可接收大量的重构。请考虑使用别的东西。
WAIT!
MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else.
这篇关于为什么我会和QUOT; SMTP无法连接到邮件服务器:"当我尝试发送电子邮件到使用MIME ::精简版Gmail帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!