Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

gmail pop3 message deletion bug?

by japhy (Canon)
on Mar 03, 2009 at 16:28 UTC ( #747785=perlquestion: print w/ replies, xml ) Need Help??
japhy has asked for the wisdom of the Perl Monks concerning the following question:

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?

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
Nos autem praedicamus Christum crucifixum (1 Cor. 1:23) - The Cross Reference (My Blog)

Comment on gmail pop3 message deletion bug?
Download Code
Re: gmail pop3 message deletion bug?
by kyle (Abbot) on Mar 03, 2009 at 16:34 UTC

    Does it help to call $pop->quit() at the end instead of just exit?

Re: gmail pop3 message deletion bug?
by mr_mischief (Prior) on Mar 03, 2009 at 16:36 UTC
    From the docs for Net::POP3:

    reset ()
    Reset the status of the remote POP3 server. This includes reseting the status of all messages to not be deleted.

    quit ()
    Quit and close the connection to the remote POP3 server. Any messages marked as deleted will be deleted from the remote mailbox.

    In POP3, the quit command is not optional. The session ending without a quit means no destructive actions will be taken. This is per RFC 1939. Take a look at section 6, titled "The UPDATE State". It says, among other things, this:

    When the client issues the QUIT command from the TRANSACTION state, the POP3 session enters the UPDATE state. (Note that if the client issues the QUIT command from the AUTHORIZATION state, the POP3 session terminates but does NOT enter the UPDATE state.) If a session terminates for some reason other than a client-issued QUIT command, the POP3 session does NOT enter the UPDATE state and MUST not remove any messages from the maildrop.
      what exactly the command "RSET" does? if it removes the marking for deletion from read email using a mail client then does "QUIT" neglects the effect of "RSET" and deletes the marked email from maildfop
Re: gmail pop3 message deletion bug?
by japhy (Canon) on Mar 03, 2009 at 16:44 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://747785]
Approved by ELISHEVA
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-07-28 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (195 votes), past polls