Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I read the body of a messages in a Gmail account from Perl?
    primarykey
    data
    text
    <p>I have readed what was posted 3 years ago here -> <a href="https://stackoverflow.com/questions/2528510/how-can-i-read-messages-in-a-gmail-account-from-perl">How can I read messages in a Gmail account from Perl?</a></p> <p>But i can't open the body .. i've readed Net::IMAP::Simple and Email::Simple; . I'm trying this.. but doesn't works, it prints de from and the subject, but not the body.</p> <pre><code>use strict; use warnings; # required modules use Net::IMAP::Simple; use Email::Simple; use IO::Socket::SSL; # fill in your details here my $username = 'email@gmail.com'; my $password = 'pass'; my $mailhost = 'imap.gmail.com'; # Connect my $imap = Net::IMAP::Simple-&gt;new( $mailhost, port =&gt; 993, use_ssl =&gt; 1, ) || die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n"; # Log in if ( !$imap-&gt;login( $username, $password ) ) { print STDERR "Login failed: " . $imap-&gt;errstr . "\n"; exit(64); } # Look in the the INBOX my $nm = $imap-&gt;select('INBOX'); # How many messages are there? my ($unseen, $recent, $num_messages) = $imap-&gt;status(); print "unseen: $unseen, recent: $recent, total: $num_messages\n\n"; ## Iterate through unseen messages for ( my $i = 1 ; $i &lt;= $nm ; $i++ ) { if ( $imap-&gt;seen($i) ) { next; } else { my $es = Email::Simple-&gt;new( join '', @{ $imap-&gt;top($i) } ); my $text = $es-&gt;body; printf( "[%03d] %s\n\t%s\n%s", $i, $es-&gt;header('From'), $es-&gt;header('Subject'),$text); } } # Disconnect $imap-&gt;quit; exit; </code></pre> <p>This print:</p> <pre><code>[001] &lt;example@example.com&gt; test subject </code></pre> <p>Not the body of the email.</p> <p>Can anyone solve this???</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload