1REFORMIME(1)                Double Precision, Inc.                REFORMIME(1)
2
3
4

NAME

6       reformime - MIME E-mail reformatting tool
7

SYNOPSIS

9       reformime [options...]
10

DESCRIPTION

12       reformime is a utility for reformatting MIME messages.
13
14       Generally, reformime expects to see an RFC 2045[1] compliant message on
15       standard input, except in few cases such as the -m option.
16
17       If no options are given, reformime prints the MIME structure of the
18       message. The output consists of so-called "MIME reference tags", one
19       per line. For example:
20
21           1
22           1.1
23           1.2
24
25       This shows that the message contains two different MIME sections. The
26       first line of the MIME structure output will always contain "1", which
27       refers to the entire message. In this case it happens to be a
28       multipart/mixed message. "1.1" refers to the first section of the
29       multipart message, which happens to be a text/plain section. "1.2"
30       refers to the second section of the message, which happens to be an
31       application/octet-stream section.
32
33       If the message is not a MIME message, or it does not contain any
34       attachments, reformime prints only "1", that refers to the entire
35       message itself:
36
37       Here's the output from reformime when the first part of the message was
38       itself a multipart/alternative section:
39
40           1
41           1.1
42           1.1.1
43           1.1.2
44           1.2
45
46       Arbitrarily complex MIME constructs are possible.
47

OPTIONS

49       -d
50           Parse a delivery status notification MIME message (RFC 1894[2]).
51           reformime expects to see on standard input a MIME message that
52           consists of a delivery status notification, as defined by RFC 1894.
53           reformime reads the message and prints on standard output a list of
54           addresses and their corresponding delivery status, as specified in
55           the delivery status notification. Each line printed by reformime
56           consists of a delivery status, a space, and the address.  reformime
57           then terminates with a 0 exit status.  reformime produces no output
58           and terminates with an exit status of 1 if the standard input does
59           not contain a delivery status notification.
60
61       -D
62           Like the -d except that reformime lists the address found in the
63           Original-Recipient: header, if it exists.
64
65       -e
66           Extract the contents of the indicated MIME section, and display it
67           on standard output. The -s option is required when -e is specified.
68           If the indicated section uses either the base64 or quoted-printable
69           encoding method, reformime automatically decodes it. In this case
70           you're better off redirecting the standard output into a file.
71
72       -i
73           Display MIME information for each section.  reformime displays the
74           contents of the Content-Type: header, any encoding used, and the
75           character set.  reformime also displays the byte offset in the
76           message where each section starts and ends (and where the actual
77           contents of the section start, after skipping all the headers).
78
79       -m
80           Create a multipart/digest MIME message digest.
81
82       -r
83           Rewrite message, adding or standardizing RFC 2045[1] MIME headers.
84
85       -r7
86           Like -r but also convert 8bit-encoded MIME sections to
87           quoted-printable.
88
89       -r8
90           Like -r but also convert quoted-printable-encoded MIME sections to
91           8bit.
92
93       -s section
94           Display MIME information for this section only.  section is a MIME
95           specification tag. The -s option is required if -e is also
96           specified, and is optional with -i.
97
98       -x
99           Extract the contents of the indicated MIME section to a file.
100
101       -X
102           Pipe the contents of the indicated MIME section to a program.
103
104   Extracting RFC 2045 MIME section(s) to file(s)
105       The -x and -X options extract a specific MIME section to a file or to a
106       pipe to an external program. Use the -s option to identify the MIME
107       section to extract. If the -s option is not specified, every MIME
108       section in the message is extracted, one at a time.  quoted-printable
109       and base64 encoding are automatically decoded.
110
111       -x
112           Interactive extraction.  reformime prints the MIME content type of
113           each section. Answer with 'y' or 'Y' to extract the MIME section.
114           Specify the filename at the next prompt.  reformime prompts with a
115           default filename.  reformime tries to choose the default filename
116           based on the MIME headers, if possible. If not, the default
117           filename will be attachment1.dat (if the -s option is not
118           specified, the next filename will be attachment2.dat, and so on).
119
120       -xPREFIX
121           Automatic extraction.  reformime automatically extracts one or more
122           MIME sections, and saves them to a file. The filename is formed by
123           taking PREFIX, and appending the default filename to it. Note that
124           there's no space between "-x" and "PREFIX". For example:
125
126               reformime -xfiles-
127           This command saves MIME sections as files-attachment1.dat, then
128           files-attachment2.dat, etc.  reformime tries to append the filename
129           specified in the MIME headers for each section, where possible.
130           reformime replaces all suspect characters with the underscore
131           character.
132
133       -X prog arg1 arg2 ...
134           The -X option must be the last option to reformime.  reformime runs
135           an external program prog, and pipes the contents of the MIME
136           section to the program.  reformime sets the environment variable
137           CONTENT_TYPE to the MIME content type. The environment variable
138           FILENAME gets set to the default filename of reformime's liking. If
139           the -s option is not specified, the program runs once for every
140           MIME section in the message. The external program, prog must
141           terminate with a zero exit status in order for reformime to proceed
142           to the next MIME section in the message. In any case, if prog
143           terminates with a non-zero exit status, reformime terminates with
144           the exit status of 20 plus prog's exit status.
145
146       Note
147       reformime extracts every MIME section in the message unless the -s
148       option is specified. This includes even the text/plain MIME content
149       that usually precedes a binary attachment.
150
151   Adding RFC 2045 MIME headers
152       The -r option performs the following actions:
153
154       If there is no Mime-Version:, Content-Type:, or
155       Content-Transfer-Encoding: header, reformime adds one.
156
157       If the Content-Transfer-Encoding: header contains 8bit or raw, but only
158       seven-bit data is found, reformime changes the
159       Content-Transfer-Encoding header to 7bit.
160
161       -r7 does the same thing, but also converts 8bit-encoded content that
162       contains eight-bit characters to quoted-printable encoding.
163
164       -r8 does the same thing, but also converts quoted-printable-encoded
165       content to 8bit, except in some situations.
166
167   Creating multipart/digest MIME digests
168       The -m option creates a MIME digest.  reformime reads a list of
169       filenames on standard input. Each line read from standard input
170       contains the name of a file that is presumed to contain an RFC
171       2822-formatted message.  reformime splices all files into a
172       multipart/digest MIME section, and writes it to standard output.
173
174   Translating MIME headers
175       The following options do not read a message from standard input. These
176       options process MIME headers via the command line, and are designed to
177       be conveniently used by mail-handling scripts.
178
179       -h "header"
180           Decode a MIME-encoded "header" and print the decoded 8-bit content
181           on standard output. Example:
182
183               $ reformime -h '=?iso-8859-1?Q?H=F3la!?='
184               Hóla!
185
186       -o "text"
187           MIME-encode "text", and print the results on standard output. Use
188           the -c option to specify the character set.
189
190       -O "text"
191           Like the -o option, except that text is a structured header with
192           RFC 2822 addresses.
193

SEE ALSO

195       reformail(1)[3], sendmail(8), mailbot(1)[4], maildrop(1)[5],
196       maildropfilter(5)[6], egrep(1), grep(1), sendmail(8).
197

REFERENCES

199        1. RFC 2045
200           http://www.rfc-editor.org/rfc/rfc2045.txt
201
202        2. RFC 1894
203           http://www.rfc-editor.org/rfc/rfc1894.txt
204
205        3. reformail(1)
206           reformail.html
207
208        4. mailbot(1)
209           mailbot.html
210
211        5. maildrop(1)
212           maildrop.html
213
214        6. maildropfilter(5)
215           maildropfilter.html
216
217
218
219Double Precision, Inc.            04/22/2007                      REFORMIME(1)
Impressum