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

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?


Solution 1:

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

Solution 2:

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.