E-mail Holding Tanks

I suspect my situation really isn’t that different from a lot of people. I get a lot of e-mail every day. Easily 250 messages on a good day, and well over 1,000 on a bad day. I get a copy of every error that occurs on our site, an e-mail for every cron job that runs anywhere, and a whole lot of other junk. I have Exchange set up to filter my mail before it lands in my Inbox, which helps keep me sane.

Some mail I want to keep forever. I consult my “Sent Items” folder often enough that I don’t intend to ever purge it. Same goes for my “Archival – Keep” folder. But I also have a lot of folders on the mailserver that are basically holding tanks. Periodically I go through and clean out the accumulated crap. I realize I don’t need copies of errors that occured in January, or cron jobs from December, and go crazy deleting things.

There are a few problems with that. The biggest, really, is that it’s a waste of my time. But I’m sitting here blogging about it, so I can’t complain about that. 😉

The other one is that Exchange (and probably any other mailserver) really, really hates it when you highlight 10,000 messages and hit delete. And by “Exchange really, really hates it,” I mean you start hearing everyone in the office asking each other, “Is e-mail down for you, too?” So I learned my lesson and wrote nice-delete.pl, a simple little Perl script using Net::IMAP to grab a list of all mail in a folder and iterate over the messages, deleting 50, expunging the mailbox, and then sleeping for 3 seconds. That keeps the load down.

I’ve thought about extending it to run weekly via cron, download each message, and check the headers to see if it’s older than, say, 21 days, and just trash it if so. But then I realized: I use Thunderbird, which has an ungodly amount of plugins. Surely, someone has written this before!

Unless my Google-fu is failing me, though, no one has. Is it really that uncommon of a request to want to auto-purge certain folders after a while? And, more importantly, what does it take to write a Thunderbird extension?

Leave a Reply

Your email address will not be published. Required fields are marked *