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?


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

  • Just would like to chip in that munpack works great for Unix enviroments. – AlbertEngelB Oct 16 '14 at 14:18
  • munpack tells me Did not find anything to unpack for a .eml that contains 2 attachments. – Nicolas Raoul Oct 27 '14 at 6:39
  • In my case munpack doesn't recognize base64 encoding, munpack: warning: ignoring unknown content transfer encoding – overdriven Aug 11 '16 at 9:12

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.