如何从原始电子邮件中提取图像?


18

我敢肯定会有很多答案,这是一个奇怪的问题。有人给我发送了一封电子邮件,其中嵌入了大量的图像。

这是原始消息结尾的开始方式(它将继续处理一百多个文件):

...</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
...

有没有什么可以解析此原始电子邮件并将其转换为一堆图片的?

Answers:


20

嗯,这比我最初想象的要容易。一定是在寻找错误的东西:

$ 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
仅供参考,您可以执行以下操作并使用mime-construct
psusi

@psusi无疑,有一天我会遇到这种情况,所以谢谢。
奥利(Oli)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.