LinuxCommandLibrary

munpack

TLDR

Extract MIME attachments

$ munpack [message.mime]
copy
Extract from stdin
$ cat [email.eml] | munpack
copy
Extract to specific directory
$ munpack -C [output_dir] [message.mime]
copy
Quiet mode
$ munpack -q [message.mime]
copy
Force overwrite
$ munpack -f [message.mime]
copy

SYNOPSIS

munpack [options] [files...]

DESCRIPTION

munpack extracts files from MIME-encoded messages. It decodes base64 and quoted-printable content and saves attachments as separate files.
munpack is the companion to mpack and handles multipart MIME messages.

PARAMETERS

-f

Force overwrite existing files.
-q
Quiet mode.
-t
Text mode (convert newlines).
-C dir
Extract to directory.

EXAMPLE

$ # Extract from email
munpack saved_email.eml

# Extract from mailbox
formail -s munpack < mbox

# Extract to specific folder
munpack -C ~/attachments email.mime
copy

SUPPORTED ENCODINGS

$ - Base64
- Quoted-printable
- Uuencode (legacy)
- BinHex (legacy)
copy

CAVEATS

Filenames may be sanitized. Nested MIME may need multiple passes. Some legacy encodings not fully supported.

HISTORY

munpack was written by John G. Myers at Carnegie Mellon University as part of the MIME utilities for handling email attachments.

SEE ALSO

mpack(1), uudecode(1), base64(1), ripmime(1)

Copied to clipboard