Click here to get back home

Net::POP3 quit failing, cannot delete some spam email

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Net::POP3 quit failing, cannot delete some spam email James 08-31-2004
Posted by James on August 31, 2004, 10:13 am
Please log in for more thread options
Thanks in advance for reading my message.
I have a perl program that eats in email (usually 100+ at a time)
looking for certain ones it wants to keep (as local files) and
flagging each one for deletion after it is done. I'm having trouble
with certain spam messages that seem to make ->quit() fail.

From my understanding of this, rarely - every once in a while an email
will either not be standard or corrupted in some way to prevent the
deletion. Since one in the batch won't delete, quit fails and the
entire batch doesn't delete. The next time it runs the same messages
will be there and so on and so on...

The only way to terminate a bad e-mail/spam is to use a html web email
client and shoot spam until I kill it by hand.

Does anyone know how to delete stubborn spam or how to get around this
problem?

foreach $msg_id (keys(%$Messages))
{
my $MsgContent = $pop3->top($msg_id, 1000);
print "ID: $msg_id n";
PrintList(@$MsgContent);
$pop3->delete($msg_id); # delete every message, since these are
all copies
}
$pop3->quit();


Posted by Michael Piotrowski on September 1, 2004, 5:15 pm
Please log in for more thread options
newsgroups@darkharmony.net (James) writes:

> Thanks in advance for reading my message.
> I have a perl program that eats in email (usually 100+ at a time)
> looking for certain ones it wants to keep (as local files) and
> flagging each one for deletion after it is done. I'm having trouble
> with certain spam messages that seem to make ->quit() fail.
>
> From my understanding of this, rarely - every once in a while an email
> will either not be standard or corrupted in some way to prevent the
> deletion. Since one in the batch won't delete, quit fails and the
> entire batch doesn't delete. The next time it runs the same messages
> will be there and so on and so on...
>
> The only way to terminate a bad e-mail/spam is to use a html web email
> client and shoot spam until I kill it by hand.
>
> Does anyone know how to delete stubborn spam or how to get around this
> problem?

I'm using basically the same code, and I haven't seen this behavior.
Considering how POP3 works (namely that messages are first marked to
be deleted using DELE and only deleted when QUIT is received), and
considering that you *can* delete the messages, I think that maybe the
QUIT isn't received at all, but that the connection is terminated
before, probably during or after the TOP command.

It would then be necessary to find out who's closing the connection,
the client (Net::POP3 in this case) or the server.

If you've got such a message, I would first try and connect to the
POP3 server using telnet and issue manually the same commands that
your client issues (it's really easy) to see whether it's the server.

If it's not the server, then you'd have to look at Net::POP3.

HTH

--
Public key at <http://www.dynalabs.de/mxp/pubkey.txt>


Similar ThreadsPosted
Script to delete email from an account February 1, 2006, 11:07 am
how to read email automatically without POP3 and IMAP servers in perl? December 13, 2004, 1:06 pm
FTP problem with delete June 14, 2005, 12:22 pm
XML::XPath delete function November 26, 2007, 3:35 pm
Error in delete file using NET:FTP module February 10, 2006, 6:31 pm
Net::POP3, last() returns nothing March 1, 2005, 9:42 pm
SSL Authentication using Net::POP3 June 25, 2006, 4:40 pm
mod_perl POP3/SMTP libraries? April 13, 2006, 3:45 pm
tests failing for .xs routines October 4, 2005, 10:19 am
LWP connect failing - bad hostname June 7, 2006, 12:28 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap