Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Mail::IMAPClient->new hangs in Windows

by Khen1950fx (Canon)
on Mar 25, 2013 at 22:13 UTC ( #1025404=note: print w/ replies, xml ) Need Help??


in reply to Mail::IMAPClient->new hangs in Windows

For Windows, try SSLv2; also, SSL_verify_none is the default, so why write it longhand?

#!/usr/bin/perl use strict; use warnings; use IO::Socket::SSL; use Mail::IMAPClient; my $client = Mail::IMAPClient->new( Server => 'imap.gmail.com', Port => 993, Ssl => 1, User => 'whateverUser', Password => 'aG00dP455w0rd', Socket => IO::Socket::SSL->new( Proto => 'tcp', PeerAddr => 'imap.gmail.com', PeerPort => '993', SSL_version => 'SSLv3', SSL_verify_mode => 0), ); die $! unless print "Connected\n";
Updated: Fixed typo.


Comment on Re: Mail::IMAPClient->new hangs in Windows
Download Code
Re^2: Mail::IMAPClient->new hangs in Windows
by m0skit0 (Initiate) on Mar 26, 2013 at 19:22 UTC
    Thanks for the reply. I already solved this.
    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', Ssl => 1, Socket => $socket ) or die "Cannot connect ($@)\n"; return $client; }
    And yes, I have to explicitly specify the verify mode, otherwise it spits a warning message.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025404]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2015-07-02 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (46 votes), past polls