我添加了从我的网站发送电子邮件的选项,但它不适用于登台和生产服务器(nginx)。
它适用于localhost
我将他们的IP地址添加到它曾经工作过的/postfix/main.cf
文件中,之后没用。为什么?
my $mailer = MIME::Lite->new(
From => $from,
To => $to,
"Reply-To" => $from,
Subject => "Sharing this post : $sub",
Type => 'text/plain',
Encoding => '8bit',
Data => $body
);
eval { $mailer->send_by_smtp('mail.holla.org'); };
if($@) {
#my @errors = $mailer->errstr;
#$.error(@errors);
$.error('<span style="color:#ce4c4c;">ERROR ($@):</span> your comment could not be sent at this time, please try again in a few minutes.')
}
}
添加调试后更新
MIME::Lite::SMTP>>> MIME::Lite::SMTP
MIME::Lite::SMTP>>> Net::SMTP(2.31)
MIME::Lite::SMTP>>> Net::Cmd(2.29)
MIME::Lite::SMTP>>> Exporter(5.64_03)
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: Unexpected EOF on command channel at /usr/local/share/perl/5.14.2/MIME/Lite.pm line 2874.
第2874行
my $smtp = MIME::Lite::SMTP->new( $hostname, %opts )
or Carp::croak "SMTP Failed to connect to mail server: $!\n";