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?

Oli
  • 293,335

1 Answers1

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)
Oli
  • 293,335