munpack
TLDR
Extract MIME attachments
$ munpack [message.mime]
Extract from stdin$ cat [email.eml] | munpack
Extract to specific directory$ munpack -C [output_dir] [message.mime]
Quiet mode$ munpack -q [message.mime]
Force overwrite$ munpack -f [message.mime]
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
munpack saved_email.eml
# Extract from mailbox
formail -s munpack < mbox
# Extract to specific folder
munpack -C ~/attachments email.mime
SUPPORTED ENCODINGS
$ - Base64
- Quoted-printable
- Uuencode (legacy)
- BinHex (legacy)
- Quoted-printable
- Uuencode (legacy)
- BinHex (legacy)
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.


