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.
95
96 -s section
97 Display MIME information for this section only. section is a MIME
98 specification tag. The -s option is required if -e is also
99 specified, and is optional with -i.
100
101 Multiple sections may be specified by separating them with commas.
102 reformime processes each section using the other options that were
103 specified.
104
105 -x
106 Extract the contents of the indicated MIME section to a file.
107
108 -X
109 Pipe the contents of the indicated MIME section to a program.
110
111 Extracting RFC 2045 MIME section(s) to file(s)
112 The -x and -X options extract a specific MIME section to a file or to a
113 pipe to an external program. Use the -s option to identify the MIME
114 section to extract. If the -s option is not specified, every MIME
115 section in the message is extracted, one at a time. If -s lists
116 multiple sections, each section gets extracted separately.
117 quoted-printable and base64 encoding are automatically decoded.
118
119 -x
120 Interactive extraction. reformime prints the MIME content type of
121 each section. Answer with 'y' or 'Y' to extract the MIME section.
122 Specify the filename at the next prompt. reformime prompts with a
123 default filename. reformime tries to choose the default filename
124 based on the MIME headers, if possible. If not, the default
125 filename will be attachment1.dat (if the -s option is not
126 specified, the next filename will be attachment2.dat, and so on).
127
128 -xPREFIX
129 Automatic extraction. reformime automatically extracts one or more
130 MIME sections, and saves them to a file. The filename is formed by
131 taking PREFIX, and appending the default filename to it. Note that
132 there's no space between "-x" and "PREFIX". For example:
133
134 reformime -xfiles-
135 This command saves MIME sections as files-attachment1.dat, then
136 files-attachment2.dat, etc. reformime tries to append the filename
137 specified in the MIME headers for each section, where possible.
138 reformime replaces all suspect characters with the underscore
139 character.
140
141 -X prog arg1 arg2 ...
142 The -X option must be the last option to reformime. reformime runs
143 an external program prog, and pipes the contents of the MIME
144 section to the program. reformime sets the environment variable
145 CONTENT_TYPE to the MIME content type. The environment variable
146 FILENAME gets set to the default filename of reformime's liking. If
147 the -s option is not specified, the program runs once for every
148 MIME section in the message. The external program, prog must
149 terminate with a zero exit status in order for reformime to proceed
150 to the next MIME section in the message (or the next section
151 specified by -s). In any case, if prog terminates with a non-zero
152 exit status, reformime terminates with the exit status of 20 plus
153 prog's exit status.
154
155 Note
156 reformime extracts every MIME section in the message unless the -s
157 option is specified. This includes even the text/plain MIME content
158 that usually precedes a binary attachment.
159
160 Adding RFC 2045 MIME headers
161 The -r option performs the following actions:
162
163 If there is no Mime-Version:, Content-Type:, or
164 Content-Transfer-Encoding: header, reformime adds one.
165
166 If the Content-Transfer-Encoding: header contains 8bit or raw, but only
167 seven-bit data is found, reformime changes the
168 Content-Transfer-Encoding header to 7bit.
169
170 -r7 does the same thing, but also converts 8bit-encoded content that
171 contains eight-bit characters to quoted-printable encoding.
172
173 -r8 does the same thing, but also converts quoted-printable-encoded
174 content to 8bit, except in some situations.
175
176 Creating multipart/digest MIME digests
177 The -m option creates a MIME digest. reformime reads a list of
178 filenames on standard input. Each line read from standard input
179 contains the name of a file that is presumed to contain an RFC
180 2822-formatted message. reformime splices all files into a
181 multipart/digest MIME section, and writes it to standard output.
182
183 Translating MIME headers
184 The following options do not read a message from standard input. These
185 options process MIME headers via the command line, and are designed to
186 be conveniently used by mail-handling scripts.
187
188 -h "header"
189 Decode a MIME-encoded "header" and print the decoded 8-bit content
190 on standard output. The decoding gets carried out as if the
191 contents occurred in the “Subject” header. Example:
192
193 $ reformime -h '=?iso-8859-1?Q?H=F3la!?='
194 Hóla!
195
196 -H "header"
197 Like -h except that header is parsed as a list of email addresses,
198 like “From” or “To”.
199
200 -o "text"
201 MIME-encode "text", and print the results on standard output.
202
203 -O "text"
204 Like the -o option, except that text is a structured header with
205 RFC 2822 addresses.
206
207 -c "charset"
208 Use charset as the character set setting, by the -h, -H, -o and -O
209 options.
210
211 -u
212 This “undocumented” option reads a MIME message on standard input,
213 and converts its contents to an UTF-8-encoded character stream,
214 which is written to standard output.
215
216 The standard output receives a concatenated amalgam of the headers
217 and “text” MIME object data. It is meant to be used as part of a
218 generic search function. This option decodes various kinds of
219 header MIME encoding, the quoted-printable and base64 transfer
220 encodings of “text” MIME objects.
221
223 reformail(1)[3], sendmail(8), mailbot(1)[4], maildrop(1)[5],
224 maildropfilter(5)[6], egrep(1), grep(1), sendmail(8).
225
227 Sam Varshavchik
228 Author
229
231 1. RFC 2045
232 http://www.rfc-editor.org/rfc/rfc2045.txt
233
234 2. RFC 1894
235 http://www.rfc-editor.org/rfc/rfc1894.txt
236
237 3. reformail(1)
238 [set $man.base.url.for.relative.links]/reformail.html
239
240 4. mailbot(1)
241 [set $man.base.url.for.relative.links]/mailbot.html
242
243 5. maildrop(1)
244 [set $man.base.url.for.relative.links]/maildrop.html
245
246 6. maildropfilter(5)
247 [set $man.base.url.for.relative.links]/maildropfilter.html
248
249
250
251Courier Mail Server 06/20/2015 REFORMIME(1)