How can I read messages in a Gmail account from Perl?

Posted by kiruthika on Stack Overflow See other posts from Stack Overflow or by kiruthika
Published on 2010-03-27T07:22:32Z Indexed on 2010/03/27 15:33 UTC
Read the original article Hit count: 270

Filed under:

I have used the module Mail::Webmail::Gmail to read the new messages in my Gmail account.

I have written the following code for this purpose:

use strict;
use warnings;
use Data::Dumper;

use Mail::Webmail::Gmail;

my $gmail = Mail::Webmail::Gmail->new(
    username => 'username', password => 'password',
);


my $messages = $gmail->get_messages( label => $Mail::Webmail::Gmail::FOLDERS{ 'INBOX' } );


foreach ( @{ $messages } ) {
    if ( $_->{ 'new' } ) {
        print "Subject: " . $_->{ 'subject' } . " / Blurb: " . $_->{ 'blurb' } . "\n";
    }
}

But it didn't print anything.

Can anyone help me in this or suggest any other module for this?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about perl