Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problem downloading Drafts messages

0 views
Skip to first unread message

Yakov

unread,
May 23, 2007, 9:48:56 AM5/23/07
to Yakov
I'm having problem downloading Drafts messages using perl's
Mail::Webmail::Gmail.
Is it problem of Mail::Webmail::Gmail ? (seems unlikely to me)
Or a restriction on the gmail side ? I do get list of my drafts
messages, including
subjects and message IDs. When I try to downloaded bodies of
messages,
I get nothing. Anybody knows why ? The sampe code is below.
Thanks
Yakov
---------------------- gmail-get-drafts.pl
------------------------------
#!/usr/bin/perl

$LABEL = "Drafts";
$USER = "username";
$PASS = "mypass";

use Mail::Webmail::Gmail;
# http://search.cpan.org/~mincus/Mail-Webmail-Gmail-1.09/lib/Mail/Webmail/Gmail.pm#SENDING_MAIL

print STDERR " * logging in to gmail ...\n";
my $gmail = Mail::Webmail::Gmail->new(
username => $USER, password => $PASS
);
die "Error" if ! defined($gmail);
print "connected\n";

use Data::Dumper;
print STDERR " * getting message list for label '$LABEL' ...\n";
my $messages = $gmail->get_messages( label => $LABEL );
my $count = scalar(@$messages );
print "# $count messages\n";

print STDERR " * downloading messages ...\n";
my $progress=0;
foreach ( @{ $messages } ) {
my $msg_summary = $_;
++$progress;
printf "# --------------- %d of %d\n", $progress, $count;
print Dumper($_);

my $id = $_->{id};
print "id=<$id>\n";

my $email = $gmail->get_indv_email( id => $id );
# my $email = $gmail->get_indv_email( msg => $_ );
print Dumper($email);
}
print "\n";

0 new messages