How to extract attachments from EML files with Windows command line?

8

3

I have hundreds of EML files which are single emails with attachments.

I would like to use scripting to get the attachments, that's why I'm looking for a way to extract any attachment from a single EML file in a command line.

I could parse each file to look for the attachment and use a base64 decoder on that, but I hope that someone has already written this.

Any recommendation?

576i

Posted 2013-08-07T16:23:29.977

Reputation: 363

Tool requests are considered off-topic: http://meta.superuser.com/questions/5845/are-tool-requests-on-topic

– Ƭᴇcʜιᴇ007 – 2013-08-07T16:28:41.807

Answers

7

You can try use:

  1. mpack(Windows version of mpack/munpack using the version 1.6 source obtained from http://ftp.andrew.cmu.edu/pub/mpack/).

  2. B64Dec tool(command line supports).

stderr

Posted 2013-08-07T16:23:29.977

Reputation: 9 300

Just would like to chip in that munpack works great for Unix enviroments. – AlbertEngelB – 2014-10-16T14:18:05.147

munpack tells me Did not find anything to unpack for a .eml that contains 2 attachments. – Nicolas Raoul – 2014-10-27T06:39:00.973

In my case munpack doesn't recognize base64 encoding, munpack: warning: ignoring unknown content transfer encoding – overdriven – 2016-08-11T09:12:49.317

1

Bit of a plug, https://bitbucket.org/mookins/email-extractor It take input of .eml files in a directory, then it will iterate over these and output them to a destination folder.

It runs on Java.

mookins

Posted 2013-08-07T16:23:29.977

Reputation: 36