I don't know if this is a problem with gmail's POP3 service or the Net::POP3 (and Net::POP3::SSLWrapper) module, or some devilish combination of the two.
I have a gmail account, foo@gmail.com, that has POP3 enabled for all email, and the option for "delete gmail's copy of the email" is set.
And yet, when I run the code below, the message is not deleted. No error message is available (as far as I know). Has anyone had a similar problem with a home-grown gmail POP3 program?
use Net::POP3::SSLWrapper;
use strict;
use warnings;
pop3s {
my $pop = Net::POP3->new('pop.gmail.com', Port => 995) or die "can't
+ make pop3 connection: $!";
my $nm = $pop->login('foo@gmail.com', 'password');
my $msgs = $pop->list;
while (my ($id, $data) = each %$msgs) {
print "Message ID: $id\n";
$pop->delete($id);
}
};
__END__
Here is actual output:
[root@XBASEBK1 popgrabber]# perl jxp.pl
Messages: 4
Message ID: 4
Message ID: 1
Message ID: 3
Message ID: 2
[root@XBASEBK1 popgrabber]# perl jxp.pl
Messages: 4
Message ID: 4
Message ID: 1
Message ID: 3
Message ID: 2
[root@XBASEBK1 popgrabber]# perl jxp.pl
Messages: 4
Message ID: 4
Message ID: 1
Message ID: 3
Message ID: 2
Any ideas?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.