我编写了一个简单的Perl脚本来使用MIME :: Lite和Net :: SMTP模块发送邮件。但它导致了错误,“SMTP无法连接到邮件服务器:一个非阻塞套接字操作无法立即完成”。Perl:SMTP无法连接到邮件服务器
Perl脚本,我都试过了,
use strict;
use warnings;
use MIME::Lite;
use Net::SMTP;
my $from = '[email protected]';
my $to = '[email protected]';
my $host = 'smtp.gmail.com';
my $subject = 'A test message by script ';
my $body = "Please ignore this message as this is test from Perl scripts ";
my $msg = MIME::Lite->new (
From => $from,
To => $to,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
$msg->attach (
Type => 'TEXT',
Data => $body
) or die "Error adding the text message part: $!\n";
MIME::Lite->send('smtp', $host, Timeout=>60);
$msg->send;
实际的错误我,
G:\>perl SampleEmail.pl
SMTP Failed to connect to mail server: A non-blocking socket operation could not
be completed immediately.
at SampleEmail.pl line 26.
请帮我具体是什么,我需要检查才能正常发送邮件。
由于提前
你能说明你使用的perl的确切版本吗?我发现有关用于编译perl的特定编译器的这些问题的参考https://social.msdn.microsoft.com/Forums/vstudio/en-US/bceb27d0-621b-41ee-b536-df8c38f71598/vs-2010-winsock-问题?论坛= wsk – AnFi