pop mail cleaner

Rich Holland holland at guidancetech.com
Wed Jan 28 06:46:06 PST 2004


My provider had a major network outage that lasted 16 hours or so.  When they
came back online, their backbone had been reduced from an OC3 to ISDN speeds or
thereabouts.  While the servers were up, it made fetching mail via POP nearly
impossible, as I had 300+ messages in the mailbox and my POP client (which
shall remain nameless) attempts to download ALL messages, marking each for
deletion as it goes, and when it's got them all, then closes the connection
which allows the server to delete the messages from the mail store.

My problem was that with the really poor bandwidth, the POP client would
timeout (often after grabbing 250+ messages) and the connection would be
severed.  For the better part of the day, each time I'd connect, I would
re-download 10-200 of the same messages I'd already gotten.

To get around this, I hacked together a quick command-line pop client that lets
me basically browse my pop mailbox, deleting single messages or a range of
messages.  I can download the headers in batches of whatever size I want.  For
example, to wade through my 300+ messages, I connected up and grabbed headers
for 10 msgs at a time.  I'd review the From/Subj lines and delete all the spam
and mailing list stuff I didn't care about, then commit the change (which
really just disconnects & reconnects).  This way I was able to pare the queue
down to about 80 messages, which my silly GUI client was able to handle without
choking.

I'd be happy to chare the command-line driven client if anyone wants it; it's
now part of my permanent toolkit "just in case" it happens again down the road.


The code is < 200 lines and basically wraps the Mail::POP3Client module from
CPAN.

Cheers!
Rich
--
Rich Holland        (913) 645-1950        SAP Technical Consultant
print unpack("u","92G5S\=\"!A;F]T:&5R(\'!E<FP\@:&%C:V5R\"\@\`\`");






More information about the Baylisa mailing list