1REFORMIME(1) Double Precision, Inc. REFORMIME(1)
2
3
4
6 reformime - MIME E-mail reformatting tool
7
9 reformime [options...]
10
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 1
38
39 Here's the output from reformime when the first part of the message was
40 itself a multipart/alternative section:
41
42 1
43 1.1
44 1.1.1
45 1.1.2
46 1.2
47
48 Arbitrarily complex MIME constructs are possible.
49
51 -d
52 Parse a delivery status notification MIME message (RFC 1894[2]).
53 reformime expects to see on standard input a MIME message that
54 consists of a delivery status notification, as defined by RFC 1894.
55 reformime reads the message and prints on standard output a list of
56 addresses and their corresponding delivery status, as specified in
57 the delivery status notification. Each line printed by reformime
58 consists of a delivery status, a space, and the address. reformime
59 then terminates with a 0 exit status. reformime produces no output
60 and terminates with an exit status of 1 if the standard input does
61 not contain a delivery status notification.
62
63 -D
64 Like the -d except that reformime lists the address found in the
65 Original-Recipient: header, if it exists.
66
67 -e
68 Extract the contents of the indicated MIME section, and display it
69 on standard output. The -s option is required when -e is specified.
70 If the specified section or sections use either the base64 or
71 quoted-printable encoding method, reformime automatically decodes
72 it. In this case you're better off redirecting the standard output
73 into a file.
74
75 -i
76 Display MIME information for each section. reformime displays the
77 contents of the Content-Type: header, any encoding used, and the
78 character set. reformime also displays the byte offset in the
79 message where each section starts and ends (and where the actual
80 contents of the section start, after skipping all the headers).
81
82 -m
83 Create a multipart/digest MIME message digest.
84
85 -r
86 Rewrite message, adding or standardizing RFC 2045[1] MIME headers.
87
88 -r7
89 Like -r but also convert 8bit-encoded MIME sections to
90 quoted-printable.
91
92 -r8
93 Like -r but also convert quoted-printable-encoded MIME sections to
94 8bit, except in some situations, see below.
95
96 -rU
97 Unconditionally convert quoted-printable-encoded MIME sections to
98 8bit, even when the resulting message may not necessarily comply
99 with Internet message formatting standards. See below for more
100 information.
101
102 -s section
103 Display MIME information for this section only. section is a MIME
104 specification tag. The -s option is required if -e is also
105 specified, and is optional with -i.
106
107 Multiple sections may be specified by separating them with commas.
108 reformime processes each section using the other options that were
109 specified.
110
111 -x
112 Extract the contents of the indicated MIME section to a file.
113
114 -X
115 Pipe the contents of the indicated MIME section to a program.
116
117 Extracting RFC 2045 MIME section(s) to file(s)
118 The -x and -X options extract a specific MIME section to a file or to a
119 pipe to an external program. Use the -s option to identify the MIME
120 section to extract. If the -s option is not specified, every MIME
121 section in the message is extracted, one at a time. If -s lists
122 multiple sections, each section gets extracted separately.
123 quoted-printable and base64 encoding are automatically decoded.
124
125 -x
126 Interactive extraction. reformime prints the MIME content type of
127 each section. Answer with 'y' or 'Y' to extract the MIME section.
128 Specify the filename at the next prompt. reformime prompts with a
129 default filename. reformime tries to choose the default filename
130 based on the MIME headers, if possible. If not, the default
131 filename will be attachment1.dat (if the -s option is not
132 specified, the next filename will be attachment2.dat, and so on).
133
134 -xPREFIX
135 Automatic extraction. reformime automatically extracts one or more
136 MIME sections, and saves them to a file. The filename is formed by
137 taking PREFIX, and appending the default filename to it. Note that
138 there's no space between "-x" and "PREFIX". For example:
139
140 reformime -xfiles-
141 This command saves MIME sections as files-attachment1.dat, then
142 files-attachment2.dat, etc. reformime tries to append the filename
143 specified in the MIME headers for each section, where possible.
144 reformime replaces all suspect characters with the underscore
145 character.
146
147 -X prog arg1 arg2 ...
148 The -X option must be the last option to reformime. reformime runs
149 an external program prog, and pipes the contents of the MIME
150 section to the program. reformime sets the environment variable
151 CONTENT_TYPE to the MIME content type. The environment variable
152 FILENAME gets set to the default filename of reformime's liking. If
153 the -s option is not specified, the program runs once for every
154 MIME section in the message. The external program, prog must
155 terminate with a zero exit status in order for reformime to proceed
156 to the next MIME section in the message (or the next section
157 specified by -s). In any case, if prog terminates with a non-zero
158 exit status, reformime terminates with the exit status of 20 plus
159 prog's exit status.
160
161 Note
162 reformime extracts every MIME section in the message unless the -s
163 option is specified. This includes even the text/plain MIME content
164 that usually precedes a binary attachment.
165
166 Adding RFC 2045 MIME headers
167 The -r option performs the following actions:
168
169 If there is no Mime-Version:, Content-Type:, or
170 Content-Transfer-Encoding: header, reformime adds one.
171
172 If the Content-Transfer-Encoding: header contains 8bit or raw, but only
173 seven-bit data is found, reformime changes the
174 Content-Transfer-Encoding header to 7bit.
175
176 -r7 does the same thing, but also converts 8bit-encoded content that
177 contains eight-bit characters to quoted-printable encoding.
178
179 -r8 does the same thing, but also converts quoted-printable-encoded
180 content to 8bit, except in some situations. The content remains
181 quoted-printable if converting it results in excessively long lines of
182 text.
183
184 -rU always converts quoted-printable-encoded content to 8bit
185 potentially resulting in excessively long lines of text. The resulting
186 message should not be resubmitted for mail delivery, as a delivery
187 failure may occur.
188
189 Creating multipart/digest MIME digests
190 The -m option creates a MIME digest. reformime reads a list of
191 filenames on standard input. Each line read from standard input
192 contains the name of a file that is presumed to contain an RFC
193 2822-formatted message. reformime splices all files into a
194 multipart/digest MIME section, and writes it to standard output.
195
196 Translating MIME headers
197 The following options do not read a message from standard input. These
198 options process MIME headers via the command line, and are designed to
199 be conveniently used by mail-handling scripts.
200
201 -h "header"
202 Decode a MIME-encoded "header" and print the decoded 8-bit content
203 on standard output. The decoding gets carried out as if the
204 contents occurred in the “Subject” header. Example:
205
206 $ reformime -h '=?iso-8859-1?Q?H=F3la!?='
207 Hóla!
208
209 -H "header"
210 Like -h except that header is parsed as a list of email addresses,
211 like “From” or “To”.
212
213 -o "text"
214 MIME-encode "text", and print the results on standard output.
215
216 -O "text"
217 Like the -o option, except that text is a structured header with
218 RFC 2822 addresses.
219
220 -c "charset"
221 Use charset as the character set setting, by the -h, -H, -o and -O
222 options.
223
224 -u
225 This “undocumented” option reads a MIME message on standard input,
226 and converts its contents to an UTF-8-encoded character stream,
227 which is written to standard output.
228
229 The standard output receives a concatenated amalgam of the headers
230 and “text” MIME object data. It is meant to be used as part of a
231 generic search function. This option decodes various kinds of
232 header MIME encoding, the quoted-printable and base64 transfer
233 encodings of “text” MIME objects.
234
236 reformail(1)[3], sendmail(8), mailbot(1)[4], maildrop(1)[5],
237 maildropfilter(5)[6], egrep(1), grep(1), sendmail(8).
238
240 Sam Varshavchik
241 Author
242
244 1. RFC 2045
245 http://www.rfc-editor.org/rfc/rfc2045.txt
246
247 2. RFC 1894
248 http://www.rfc-editor.org/rfc/rfc1894.txt
249
250 3. reformail(1)
251 http://www.courier-mta.org/maildrop/reformail.html
252
253 4. mailbot(1)
254 http://www.courier-mta.org/maildrop/mailbot.html
255
256 5. maildrop(1)
257 http://www.courier-mta.org/maildrop/maildrop.html
258
259 6. maildropfilter(5)
260 http://www.courier-mta.org/maildrop/maildropfilter.html
261
262
263
264Courier Mail Server 02/16/2018 REFORMIME(1)