19

Rather an odd problem that I'm sure has a multitude of answers. Somebody sent me an email with a ton of images embedded into the email body.

Here's how the end of the raw message starts (it goes on for over a hundred different files):

...</body></html>=

--Apple-Mail=_AAAA58DC-2C74-402A-B582-AAAAAA4E33AA
Content-Transfer-Encoding: base64
Content-Disposition: inline;
    filename=cat.jpeg
Content-Type: image/jpg;
    name="cat.jpeg"

/9j/4AAQSkZJRgABAQAAAQABAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdC
IFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAA
AADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFj
...

Is there anything out there that can parse this raw email and turn it into a pile of pictures?

1 Answer 1

22

Well that was easier than I first thought. Must have been searching for the wrong thing:

$ sudo apt-get install mpack
$ munpack email.eml 
cat.jpeg (image/jpg)
Fleur4.jpeg (image/jpg)
kasper.jpeg (image/jpg)
moreno.jpeg (image/jpg)
orla.jpeg (image/jpg)
oscar.jpeg (image/jpg)
saidi.jpeg (image/jpg)
teo.jpeg (image/jpg)
tigra.jpeg (image/jpg)
3
  • 3
    FYI, you can do the reverse and construct such a message with mime-construct
    – psusi
    Sep 12, 2013 at 13:46
  • @psusi I will undoubtedly run into such a situation one day, so thanks.
    – Oli
    Sep 12, 2013 at 13:50
  • I was doing this from Windows. Fortunately I had WSL/Ubuntu installed, so I had this done in a couple of minutes. Dec 15, 2022 at 2:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .