reformime(1)

NAME
reformime - MIME utility

SYNOPSIS
reformime [options] ...

DESCRIPTION

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.2

This 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/mixed message. "1.1" refers to the first section of the multiparty message, which happens to be a text/plain section. "1.2" refers to the second section of the message, which happens to be an application/octet-stream section. 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

    1

If, instead the first part of the message was itself a multipart/alternative section, you might see the following instead:

    1
    1.1
    1.1.1
    1.1.2
    1.2

Arbitrarily complex MIME constructs are possible.

OPTIONS

-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 -d option, 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 base64 or quoted-printable encoding 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. reformime will display the contents of the Content-Type: header, any encoding used, and the character set. reformime will 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.

  Extracting RFC 2045 MIME section(s) to file(s)

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. reformime prints the MIME content type of each section. Answer with 'y' or 'Y' to extract the MIME section. Specify the filename at the next prompt. reformime will 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 files-attachment1.dat, then files-attachment2.dat, etc. reformime will 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 reformime. reformime will 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_TYPE to the MIME content type. The environmetn variable FILENAME will 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 text/plain MIME part that usually precedes a binary attachment.

  Adding RFC 2045 MIME headers

The -r option performs the following actions:

If there is no Mime-Version:, Content-Type:, or Content-Transfer-Encoding: header, reformime will add one.

If the Content-Transfer-Encoding: header contains 8bit or raw, but only seven-bit data is found, the Content-Transfer-Encoding header is changed to 7bit.

-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.

  Creating MIME message digests

The -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.

If -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.

BUGS

-x and -X ignores the Content-Disposition: header.

FILES

$HOME/.tmp - directory for temporary files. Automatically created, if necessary.

SEE ALSO
maildrop(1), maildropfilter(1), makemime(1), reformail(1), egrep(1), grep(1), courier(8), sendmail(8), RFC 1894, RFC 2045.