in reply to Getting started with Net::IMAP::Simple

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))'

Replies are listed 'Best First'.
Re^2: Getting started with Net::IMAP::Simple
by dihewidd (Novice) on Feb 06, 2012 at 17:10 UTC

    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?