Perl : Reading messages in gmail account

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 7:33 UTC
Read the original article Hit count: 275

Filed under:

Hi all,

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