Strip Attachments from Outlook Express Emails

I have been using Outlook Express for almost 10 years now. I have gigabytes of emails stored in it dating back that far.

Lots of the emails are from game publishers or various press sources and often include really ridiculously huge attachments. I often don’t need these attachments at all, so I’d like to be able to delete the attachments but keep the email just as a record.

Outlook Express, presumably through some sort of misguided security reason, doesn’t let you open an old email and just delete the attachment. What you can do is drag the email out to your desktop, where it will create a .eml file – basically a plain text version of the email with the attachments encoded. You can then just strip out the attachments manually (a relatively simple process) by opening them in a text editor and removing the relevant sections.

I got bored of doing this so wrote a quick PHP script to do it, using the PEAR mimeDecode package. It’s really rough and simple but basically consists of two parts:

1) a PHP script which parses the email, spits out the attachments, and spits out a re-written version of the email just in plain text.
2) a batch file which calls the PHP script, so you can just drag a .eml file onto the batch file and have it execute.

The PHP script is available here.

The batch file just looks like this – change it to suit your system:
c:\php\php.exe c:\utils\mailextract.php %1

One thought on “Strip Attachments from Outlook Express Emails”

Leave a Reply

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

The reCAPTCHA verification period has expired. Please reload the page.