dihewidd has asked for the wisdom of the Perl Monks concerning the following question:

Two fun and interesting errors...

USING PORT 993 and SSL to imap.gmail.com

Unable to connect to IMAP: connection failed IO::Socket::SSL: bind: Address family not supported by protocol family

USING PORT 143 and NO SSL to imap.gmail.com

Unable to connect to IMAP: connection failed connect: Operation timed out

Yes, imap is enabled on this gmail account. I have successfully accessed it from my iPhone.

Replies are listed 'Best First'.
Re: Getting started with Net::IMAP::Simple
by zwon (Abbot) on Feb 06, 2012 at 12:54 UTC

    Works for me, maybe you're doing something wrong...

    P.S.: it is generally a good idea to post the code that produces error messages along with error messages. Here's the line you can use to check how it works:

    perl -MNet::IMAP::Simple -E'say Net::IMAP::Simple->new(q(imap.gmail.co +m:993), use_ssl => 1, debug => 1)->login(qw(user pass))'

      Using the code right off the man page

      # use strict; use warnings; use Net::IMAP::Simple; use Email::Simple; #use IO::Socket::SSL; $mailhost = "imap.gmail.com"; # Create the object my $imap = Net::IMAP::Simple->new( $mailhost, port => 993, use_ssl => 1, debug => 1, ) || die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n"; # Log on if(!$imap->login('login','pass')){ print STDERR "Login failed: " . $imap->errstr . "\n"; exit(64); } # Print the subject's of all the messages in the INBOX my $nm = $imap->select('INBOX'); for(my $i = 1; $i <= $nm; $i++){ if($imap->seen($i)){ print "*"; } else { print " "; } my $es = Email::Simple->new(join '', @{ $imap->top($i) } ); printf("[%03d] %s\n", $i, $es->header('Subject')); } $imap->quit;
        Works fine with SSL on Linux here. Non-SSL times out, probably because Google doesn't offer non-SSL IMAP any more. Perhaps your OS has some issues?