http://qs1969.pair.com?node_id=1192331

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

Dear monks, i have written a small script to check my gmail inbox and report the latest 5 messages. What i cannot figure out i how to extract the cc field from the email header. Hope someone can tell me, thank you.

use Mail::IMAPClient; use IO::Socket::SSL; $sock = IO::Socket::SSL->new( PeerAddr => "imap.gmail.com", PeerPort => 993) or die $@; $client = Mail::IMAPClient->new( Socket => $sock, User => 'anyany@gmail.com', Password => '*****' ); $client->select("INBOX"); @messages = $client->messages; for($x=1;$x<=5;$x++){ $bs = pop(@messages); $from = $client->get_header($bs,"from"); $date = $client->get_header($bs,"date"); $subj = $client->get_header($bs,"subject"); print "From:$from\nDate:$date\nSubject:$subj\n\n"; } $client->logout();