Thanks! That worked like a champ. Should have known that python was the answer.
On Fri, Jan 11, 2002 at 11:16:52AM -0600, Ron Johnson wrote: > -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > > On Friday 11 January 2002 11:03 am, Rick Pasotto wrote: > > Some of my email get delivered to my isp's pop3 server and I > > retrieve it with fetchmail. A couple of days ago I got a piece of > > spam that produces a protocol error. Fetchmail retrieves the headers > > for this one email, gets the error, and quits -- leaving the bad > > email on the server to repeat the process the next time it checks > > for mail. > > > > Is there a program or manual way I can just delete that one message > > and then let fetchmail do its thing? > > If you have python on your machine, then you can run this script to > delete as many (or few) messages directly off the pop server. > > import getpass, poplib, string > M = poplib.POP3('mail.yourisp.com') > M.user('yourusername') > M.pass_(getpass.getpass()) > numMessages = len(M.list()[1]) > print numMessages > x = M.list(0) > for i in range(1, numMessages): > print '==============================================' > print '==============================================' > x = M.top(i, 0) > print i > for y in x[1]: > z = string.split(y, ' ') > if z[0] in ('Date:', 'From:', 'To:', 'Subject:'): > print z > a = raw_input('Delete this message?') > if a in ('Y', 'y'): > M.dele(i) > if a in ('Q', 'q'): > break > M.quit() -- Every citizen who has produced or acquired a product should have the option of applying it immediately to his own use or of transferring it to whoever on the face of the earth agrees to give him in exchange the object of his desires. To deprive him of this option . . . solely to satisfy the convenience of another citizen, is to legitimize an act of plunder and to violate the law of justice. -- Frédéric Bastiat (1801-1850) Rick Pasotto [EMAIL PROTECTED] http://www.niof.net