Extending and Enhancing mboxscrub.pl

This script is one of those handy utilities that you will either use often or not at all. It will depend on your usage pattern, specifically whether you need to routinely deal with old archived mailboxes. For those that do, extending this script into a full-featured utility might have some value.

There are some obvious enhancements to be made. Here are some of them:

  • The script should look into MIME entities to determine if they are of type multipart. If so, their parts should also be processed.

  • There are several places where this script could be made to be more cross platform in nature.

  • Automatic detection of mbox variants could be made and appropriate action taken. Similarly, the script could do some kind of checking to ensure that the file given as input is really a mailbox.

  • Options beyond deletion of entities could be given, such as saving the decoded entity to a file outside of the mailbox.

  • Other mailbox formats could be supported.

  • Other criteria than size may be used to recommend entities for deletion, such as age.

Chris Ryan (the infamous ) has even gone so far as to suggest an entire mailbox archiving scheme based on the concepts in this script. In his scheme, MIME attachments would be held in a hierarchical file structure and referred to by file URL from a replacement text/plain entity. A separate file would hold meta information (such as MIME headers, state information, and filing instructions). A utility would be ...

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.