munpack - unpack messages in MIME or split-uuencode format


munpack [-fqt] [-C directory] [filename ...]


The munpack(1) program reads each RFC-822 message filename and writes all non-text Multipurpose Internet Mail Extensions (MIME) parts or split-uuencoded files as files. If no file-name argument is given, munpack(1) reads from standard input.

If the message suggests a file name to use for the imbedded part, that name is cleaned of potential problem characters and used for the output file. If the suggested file name includes subdirectories, they will be created as necessary. If the message does not suggest a file name, the names "part1", "part2", and so on, are used in sequence.

If the imbedded part was preceded with textual information, that information is also written to a file. The file is named the same as the imbedded part, with any file-name extension replaced with .desc.

The munpack(1) utility accepts the following options:

-C directory
Change the current directory to directory before reading any files. This is useful when invoking munpack(1) from a mail or news reader.
Force overwriting of existing files. If a message suggests a file name of an existing file, the file will be overwritten. Without this flag, munpack(1) appends ".1", ".2", and so on, to find a nonexistent file.
Be quiet. Suppresses messages about saving partial messages and about messages with no interesting information.
Also write the text MIME parts of multipart messages as files. By default, text parts that do not have a file name parameter do not get unpacked. This option effectively disables the .desc file feature for MIME messages.


To decode a MIME message, first save it to a text file. If possible, save it with all headers included. The munpack(1) utility can decode some MIME files when the headers are missing or incomplete, other files it cannot decode without having the information in the headers. In general, messages that include a statement at the beginning that they are in MIME format can be decoded without the headers. Messages that have been split into multiple parts generally require all headers in order to be reassembled and decoded.

Some LAN-based mail systems and some mail providers place the mail headers at the bottom of the message instead of at the top. If you are having problems decoding a MIME message on such a system, convert the mail back into the standard format by removing the system's nonstandard headers and moving the standard Internet headers at the top of the message (separated from the message body with a blank line).

There must be exactly one message per file. The munpack(1) utility cannot deal with multiple messages in a single file; to decode things correctly, it must know when one message ends and the next one begins.

To decode a message, run the command:

munpack file
where file is the name of the file containing the message. More than one file name can be specified; munpack(1) will try to decode the message in each file. The options already provided include more information on ways you can run munpack(1).


The munpack(1) utility makes use of the following environment variables, if set:

Directory to store temporary files. Default is the value of
getconf CS_TMPDIR
which is normally /tmp.


Directory used to store partial messages awaiting reassembly.