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;
In reply to Re^2: Getting started with Net::IMAP::Simple
by dihewidd
in thread Getting started with Net::IMAP::Simple
by dihewidd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |