| REFORMIME(1) | Double Precision, Inc. | REFORMIME(1) |
NAME¶
reformime - MIME E-mail reformatting tool
SYNOPSIS¶
reformime [options...]
DESCRIPTION¶
reformime is a utility for reformatting MIME messages.
Generally, reformime expects to see an RFC 2045[1] compliant message on standard input, except in few cases such as the -m option.
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:
1 1.1 1.2
This shows 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. In this case it happens to be a multipart/mixed message. "1.1" refers to the first section of the multipart 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.
If the message is not a MIME message, or it does not contain any attachments, reformime prints only "1", that refers to the entire message itself:
1
Here's the output from reformime when the first part of the message was itself a multipart/alternative section:
1 1.1 1.1.1 1.1.2 1.2
Arbitrarily complex MIME constructs are possible.
OPTIONS¶
-d
International domain names get converted to the system locale's encoding. If the conversion is not possible: an address given in the delivery status notification directly in UTF-8 has its non-converted characters replaced by their hexadecimal values; a punycode-encoded address gets displayed as is. For best results the system locale's encoding should be UTF-8.
-D
-e
-i
-V
Warnings (1.1):
Bad hexadecimal quoted-printable encoding
Issues that affect the ability to parse the MIME message itself are reported as fatal errors (together with any warnings, if any, for whatever it's worth). Fatal errors result in reformime terminating with a non-0 exit code.
-m
-r
-r7
-r8
-rU
-s section
Multiple sections may be specified by separating them with commas. reformime processes each section using the other options that were specified.
-x
-X
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. If -s lists multiple sections, each section gets extracted separately. quoted-printable and base64 encoding are automatically decoded.
-x
-xPREFIX
reformime -xfiles-
-X prog arg1 arg2 ...
Note
reformime extracts every MIME section in the message unless the -s option is specified. This includes even the text/plain MIME content 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 adds one.
If the Content-Transfer-Encoding: header contains 8bit or raw, but only seven-bit data is found, reformime changes the Content-Transfer-Encoding header to 7bit.
-r7 does the same thing, but also converts 8bit-encoded content that contains eight-bit characters to quoted-printable encoding.
-r8 does the same thing, but also converts quoted-printable-encoded content to 8bit, except in some situations. The content remains quoted-printable if converting it results in excessively long lines of text.
-rU always converts quoted-printable-encoded content to 8bit potentially resulting in excessively long lines of text. The resulting message should not be resubmitted for mail delivery, as a delivery failure may occur.
Creating multipart/digest MIME digests¶
The -m option creates a MIME digest. reformime reads a list of filenames on standard input. Each line read from standard input contains the name of a file that is presumed to contain an RFC 2822-formatted message. reformime splices all files into a multipart/digest MIME section, and writes it to standard output.
Translating MIME headers¶
The following options do not read a message from standard input. These options process MIME headers via the command line, and are designed to be conveniently used by mail-handling scripts.
-h "header"
$ reformime -h '=?iso-8859-1?Q?H=F3la!?=' Hóla!
-H "header"
-o "text"
-O "text"
-c "charset"
-u
The standard output receives a concatenated amalgam of the headers and “text” MIME object data. It is meant to be used as part of a generic search function. This option decodes various kinds of header MIME encoding, the quoted-printable and base64 transfer encodings of “text” MIME objects. An extra newline character is appended to each MIME entity, ensuring that MIME entities that don't end with a trailing newline will not end up having the next MIME entity's first header line glued to it.
SEE ALSO¶
reformail(1)[3], sendmail(8), mailbot(1)[4], maildrop(1)[5], maildropfilter(5)[6], egrep(1), grep(1), sendmail(8).
AUTHOR¶
Sam Varshavchik
NOTES¶
- 1.
- RFC 2045
- 2.
- RFC 3464
- 3.
- reformail(1)
- 4.
- mailbot(1)
- 5.
- maildrop(1)
- 6.
- maildropfilter(5)
| 08/28/2025 | Courier Mail Server |