Mail :: IMAPClient-> Windows中的新挂起 [英] Mail::IMAPClient->new hangs in Windows
问题描述
此Mail::IMAPClient->new()
在Windows 7中冻结:
This Mail::IMAPClient->new()
freezes in Windows 7:
sub connectGMail
{
my $client = Mail::IMAPClient->new
(
Server => 'imap.gmail.com',
Port => 993,
Ssl => 1,
User => 'whateverUser',
Password => 'aG00dP455w0rd',
Socket => IO::Socket::SSL->new
(
SSL_verify_mode => SSL_VERIFY_NONE
)
)
or die "Cannot connect ($@)\n";
return $client;
}
我尝试停用Windows防火墙,但没有任何改变.
I tried deactivating Windows firewall, but nothing changed.
一个非常相似的代码在Linux中可以正常工作:
A very similar code works fine in Linux:
sub connectGMail
{
my $client = Mail::IMAPClient->new
(
Server => 'imap.gmail.com',
Port => 993,
Ssl => 1,
User => 'whateverUser',
Password => 'aG00dP455w0rd'
)
or die "Cannot connect ($@)\n";
return $client;
}
在两种情况下,Mail::IMAPClient
都可以从CPAN存储库中很好地安装,但是在Windows中,如果我不包括 Socket 选项,它会向我显示此警告
In both cases Mail::IMAPClient
was installed fine from CPAN repositories, but in Windows, if I don't include the Socket option, it shows me this warning
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
together with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
,其余脚本(用于解析电子邮件)将无法正常工作.
and the rest of the script (which parses the emails) won't work correctly.
error: unexpected end of header
error: unexpected end of header
error: unexpected end of header
我们将不胜感激,在此先感谢您.
Any help would be appreciated, thanks in advance.
推荐答案
看起来像Mail::IMAPClient->new
既不喜欢套接字,也不喜欢服务器/端口.如果我使用服务器/端口创建套接字,然后将其传递,则它确实可以成功连接.
Looks like Mail::IMAPClient->new
doesn't like both a socket and the server/port. If I create the socket with server/port then pass it, it does connect successfully.
sub connectGMail
{
my $socket = IO::Socket::SSL->new
(
PeerAddr => 'imap.gmail.com',
PeerPort => 993,
SSL_verify_mode => SSL_VERIFY_NONE
)
or die "socket(): $@";
my $client = Mail::IMAPClient->new
(
User => 'whateverUser',
Password => 'aG00dP455w0rd'
Socket => $socket
)
or die "Cannot connect ($@)\n";
return $client;
}
这篇关于Mail :: IMAPClient-> Windows中的新挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!