Ubuntu Linux unpack mime encoded mail files

Sometimes when clients forward emails through the encoding gets stuffed up and you end up with an attachment that contains the clients message along with any files.

If you open this attachment in notepad or whatever you will see all the email headers and stuff like this:

Received: from blah.example.com
Return-Path: blah@example.com
Date: Mon, 23 Nov 2009 13:17:59 +1100
Message-ID: <C7303C12.5ED2%eexample@example.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
X-Mailer: Microsoft Office Outlook 12.0

This is a multi-part message in MIME format.

When you run `file` on this you will get something like this:

$ file the_downloaded_attachment
the_downloaded_attachment: RFC 822 mail text

To unpack the contents of this file, install the munpack package and simply do this:

munpack the_downloaded_attachment

and it will spit out all the encoded files.




Leave a Reply

Your email address will not be published.