17

Forwarded emails are unfortunately sometimes transmitted by Outlook as .eml files, which are unusable for normal users. In particular, extracting attachments from .eml files is a challenge.

What software can extract all attachments contained in a .eml file?

Requirements:

  • Free
  • Open source
  • Runs on Linux
  • Output a file per attachment, with the intended name.
  • No need to compile (binaries available, or script)
  • Reasonably fast to install, I would rather avoid having to set up a particular email client program just to process this .eml file.
1
  • I don't know the exact features of LookOut (Addon) for Thunderbird, but it gives in provides very good interoperability with the proprietary formats. You may try if this fixes it.
    – sebix
    Commented Oct 27, 2014 at 7:19

3 Answers 3

22

From the definition of munpack:

Unpack messages in MIME or split-uuencode format.
Munpack are utilities for encoding and decoding (respectively) binary files in MIME (Multipurpose Internet Mail Extensions) format mail messages.

To Install:

sudo apt-get install mpack

To extract the eml contents

munpack 1.eml
0
5

If you want to get hold of MIME parts that don't have filenames, e.g. the text and HTML, then try

sudo apt install maildir-utils
mu extract source.eml --save-all

Docs: https://manpages.debian.org/testing/maildir-utils/mu-extract.1.en.html

1
  • 1
    maildir-utils rocks
    – Sérgio
    Commented Nov 27, 2022 at 18:06
0

Those are all good answers, but for completeness's sake, I figured I would add more such options because some of the aforementioned tools might not be as readily available as others.

The perl-MIME-tools package includes a variety of command-line tools for processing MIME-encoded messages, including mimeexplode:

Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into subdirectories of the
current working directory.  The subdirectories are just called "msg0",
"msg1", "msg2", etc.  Existing directories are skipped over. ```

The ripmime command is packaged in EPEL, if that meets your "packaged by the vendor" requirements.

This is partly taken from this Server Fault answer, links added by myself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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