reformime [options] ...
reformime is a tool for manipulating MIME messages and attachments.
reformime expects to see an RFC 2045, message on standard input.
If no options are given, reformime prints the MIME structure of the message. The output consists of so-called "MIME reference tags", one per line. For example, you might see the following output:
1 1.1 1.2This tells you that the message contains two different MIME sections. The first line of the MIME structure output will always contain "1", which refers to the entire message, which happens to be a
multipart/mixedmessage. "1.1" refers to the first section of the multiparty message, which happens to be a
text/plainsection. "1.2" refers to the second section of the message, which happens to be an
application/octet-streamsection. This is a typical situation.
If the message is not a MIME message, or it does not contain any attachments, you will see a rather boring
1If, instead the first part of the message was itself a
multipart/alternativesection, you might see the following instead:
1 1.1 1.1.1 1.1.2 1.2
Arbitrarily complex MIME constructs are possible.
-d- parse a delivery status notification MIME message (RFC 1894). reformime expects to see on standard input a MIME message that consists of a delivery status notification, as defined by RFC 1894. reformime reads the message and prints on standard output a list of addresses and their corresponding delivery status, as specified in the delivery status notification. Each line printed by reformime consists of a delivery status, a space, and the address reformime will terminate with a 0 exit status. reformime produces no output and terminates with an exit status of 1 if the standard input does not contain a delivery status notification.
-D- like the
-doption, except that it lists the "original" recipient address, if provided. See RFC 1894 for more information.
-e- extract the contents of the indicated MIME section, and display it on standard output. The -s option is required when -e is specified. If the indicated section uses either the
quoted-printableencoding method, reformime automatically decodes it. In this case you're better off redirecting the standard output into a file.
-x- extract the contents of the indicated MIME section to a file.
-X- pipe the contents of the indicated MIME section to a program.
-i- display MIME information for each section.
reformimewill display the contents of the Content-Type: header, any encoding used, and the character set.
reformimewill also display at which byte offset in the message each section starts and ends (and where the actual contents of the section start, skipping all the headers).
-s section- display MIME information for this section only. section is a MIME specification tag. The -s option is required if -e is also specified, and is optional with -i.
-r- rewrite message, adding or standardizing RFC 2045 MIME headers.
-r7- also convert MIME sections with 8bit encoding to quoted-printable encoding.
-r8- also convert MIME sections with quoted-printable encoding to 8bit encoding, where possible.
-m file1 file2 ...- create a MIME message digest.
The -x and -X options extract a specific MIME section to a file or to a pipe to an external program. Use the -s option to identify the MIME section to extract. If the -s option is not specified, every MIME section in the message is extracted, one at a time. quoted-printable and base64 encoding are automatically decoded.
-x- interactive extraction.
reformimeprints the MIME content type of each section. Answer with 'y' or 'Y' to extract the MIME section. Specify the filename at the next prompt.
reformimewill prompt with a default filename. reformime tries to choose the default filename based on the MIME headers, if possible. If not, the default filename will be
attachment1.dat(if the -s option is not specified, the next filename will be
attachment2.dat, and so on).
-xPREFIX- automatic extraction. reformime will automatically extract one or more MIME sections, and save them to a file. The filename will be formed by taking PREFIX, and appending the default filename to it. Note that there may not be a space between "-x" and "PREFIX". For example: "reformime -xfiles-" - this will save MIME sections as
reformimewill try to append the filename specified in the MIME headers for each section. reformime will replace all suspect characters with the underbar, when using the filename specified in the MIME headers.
-X prog arg1 arg2 ...- the -X option must be the last option to
reformimewill run an external program specified by "prog", and pipe the contents of the MIME section to the program. reformime will set the environment variable
CONTENT_TYPEto the MIME content type. The environmetn variable
FILENAMEwill be set to the default filename of reformime's liking. If the -s option is not specified, the program will be executed one time for every MIME section in the message.
NOTE: reformime will extract every MIME section in the message
unless the -s option is specified. Yes, even the
part that usually precedes a binary attachment.
The -r option performs the following actions:
If there is no
Content-Transfer-Encoding: header contains
raw, but only seven-bit data is found,
Content-Transfer-Encoding header is changed to
-r7 does the same thing, but also converts 8bit transfer encoding containing eight-bit characters to quoted-printable encoding.
-r8 does the same thing, but also converts quoted-printable encoded sections to 8bit, except in some situations.
-m option is followed by a list of files. Each file should
contain a single RFC 822 message.
reformime prints, on standard
output, a MIME digest containing the indicated messages.
-m is not followed by at least one file,
reformime reads standard input. Each line on standard input must
contain a single filename; blank lines are not allowed.
-x and -X ignores the Content-Disposition: header.
$HOME/.tmp - directory for temporary files. Automatically
created, if necessary.