Debian Codegraph @

upstream/debian-trixie/man1/reformime.1

raw
1 '\" t
2 .\"<!-- Copyright 1998 - 2010 Double Precision, Inc. See COPYING for -->
3 .\"<!-- distribution information. -->
4 .\" Title: reformime
5 .\" Author: Sam Varshavchik
6 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Date: 11/04/2020
8 .\" Manual: Double Precision, Inc.
9 .\" Source: Courier Mail Server
10 .\" Language: English
11 .\"
12 .TH "REFORMIME" "1" "11/04/2020" "Courier Mail Server" "Double Precision, Inc\&."
13 .\" -----------------------------------------------------------------
14 .\" * Define some portability stuff
15 .\" -----------------------------------------------------------------
16 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 .\" http://bugs.debian.org/507673
18 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
19 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .ie \n(.g .ds Aq \(aq
21 .el .ds Aq '
22 .\" -----------------------------------------------------------------
23 .\" * set default formatting
24 .\" -----------------------------------------------------------------
25 .\" disable hyphenation
26 .nh
27 .\" disable justification (adjust text to left margin only)
28 .ad l
29 .\" -----------------------------------------------------------------
30 .\" * MAIN CONTENT STARTS HERE *
31 .\" -----------------------------------------------------------------
32 .SH "NAME"
33 reformime \- MIME E\-mail reformatting tool
34 .SH "SYNOPSIS"
35 .HP \w'\fBreformime\fR\ 'u
36 \fBreformime\fR [\fIoptions\fR...]
37 .SH "DESCRIPTION"
38 .PP
39 \fBreformime\fR
40 is a utility for reformatting MIME messages\&.
41 .PP
42 Generally,
43 \fBreformime\fR
44 expects to see an
45 \m[blue]\fBRFC 2045\fR\m[]\&\s-2\u[1]\d\s+2
46 compliant message on standard input, except in few cases such as the
47 \fB\-m\fR
48 option\&.
49 .PP
50 If no options are given,
51 \fBreformime\fR
52 prints the MIME structure of the message\&. The output consists of so\-called "MIME reference tags", one per line\&. For example:
53 .sp
54 .if n \{\
55 .RS 4
56 .\}
57 .nf
58 1
59 1\&.1
60 1\&.2
61 .fi
62 .if n \{\
63 .RE
64 .\}
65 .PP
66 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
67 multipart/mixed
68 message\&. "1\&.1" refers to the first section of the multipart message, which happens to be a
69 text/plain
70 section\&. "1\&.2" refers to the second section of the message, which happens to be an
71 application/octet\-stream
72 section\&.
73 .PP
74 If the message is not a MIME message, or it does not contain any attachments,
75 \fBreformime\fR
76 prints only "1", that refers to the entire message itself:
77 .sp
78 .if n \{\
79 .RS 4
80 .\}
81 .nf
82 1
83 .fi
84 .if n \{\
85 .RE
86 .\}
87 .PP
88 Here\*(Aqs the output from
89 \fBreformime\fR
90 when the first part of the message was itself a
91 multipart/alternative
92 section:
93 .sp
94 .if n \{\
95 .RS 4
96 .\}
97 .nf
98 1
99 1\&.1
100 1\&.1\&.1
101 1\&.1\&.2
102 1\&.2
103 .fi
104 .if n \{\
105 .RE
106 .\}
107 .PP
108 Arbitrarily complex MIME constructs are possible\&.
109 .SH "OPTIONS"
110 .PP
111 \-d
112 .RS 4
113 Parse a delivery status notification MIME message (\m[blue]\fBRFC 1894\fR\m[]\&\s-2\u[2]\d\s+2)\&.
114 \fBreformime\fR
115 expects to see on standard input a MIME message that consists of a delivery status notification, as defined by RFC 1894\&.
116 \fBreformime\fR
117 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
118 \fBreformime\fR
119 consists of a delivery status, a space, and the address\&.
120 \fBreformime\fR
121 then terminates with a 0 exit status\&.
122 \fBreformime\fR
123 produces no output and terminates with an exit status of 1 if the standard input does not contain a delivery status notification\&.
124 .RE
125 .PP
126 \-D
127 .RS 4
128 Like the
129 \fB\-d\fR
130 except that
131 \fBreformime\fR
132 lists the address found in the
133 Original\-Recipient:
134 header, if it exists\&.
135 .RE
136 .PP
137 \-e
138 .RS 4
139 Extract the contents of the indicated MIME section, and display it on standard output\&. The
140 \fB\-s\fR
141 option is required when
142 \fB\-e\fR
143 is specified\&. If the specified section or sections use either the
144 base64
145 or
146 quoted\-printable
147 encoding method,
148 \fBreformime\fR
149 automatically decodes it\&. In this case you\*(Aqre better off redirecting the standard output into a file\&.
150 .RE
151 .PP
152 \-i
153 .RS 4
154 Display MIME information for each section\&.
155 \fBreformime\fR
156 displays the contents of the
157 Content\-Type:
158 header, any encoding used, and the character set\&.
159 \fBreformime\fR
160 also displays the byte offset in the message where each section starts and ends (and where the actual contents of the section start, after skipping all the headers)\&.
161 .RE
162 .PP
163 \-m
164 .RS 4
165 Create a
166 multipart/digest
167 MIME message digest\&.
168 .RE
169 .PP
170 \-r
171 .RS 4
172 Rewrite message, adding or standardizing
173 \m[blue]\fBRFC 2045\fR\m[]\&\s-2\u[1]\d\s+2
174 MIME headers\&.
175 .RE
176 .PP
177 \-r7
178 .RS 4
179 Like
180 \fB\-r\fR
181 but also convert
182 8bit\-encoded MIME sections to
183 quoted\-printable\&.
184 .RE
185 .PP
186 \-r8
187 .RS 4
188 Like
189 \fB\-r\fR
190 but also convert
191 quoted\-printable\-encoded MIME sections to
192 8bit, except in some situations, see below\&.
193 .RE
194 .PP
195 \-rU
196 .RS 4
197 Unconditionally convert
198 quoted\-printable\-encoded MIME sections to
199 8bit, even when the resulting message may not necessarily comply with Internet message formatting standards\&. See below for more information\&.
200 .RE
201 .PP
202 \-s \fIsection\fR
203 .RS 4
204 Display MIME information for this section only\&.
205 \fIsection\fR
206 is a MIME specification tag\&. The
207 \fB\-s\fR
208 option is required if
209 \fB\-e\fR
210 is also specified, and is optional with
211 \fB\-i\fR\&.
212 .sp
213 Multiple sections may be specified by separating them with commas\&.
214 \fBreformime\fR
215 processes each section using the other options that were specified\&.
216 .RE
217 .PP
218 \-x
219 .RS 4
220 Extract the contents of the indicated MIME section to a file\&.
221 .RE
222 .PP
223 \-X
224 .RS 4
225 Pipe the contents of the indicated MIME section to a program\&.
226 .RE
227 .SS "Extracting RFC 2045 MIME section(s) to file(s)"
228 .PP
229 The
230 \fB\-x\fR
231 and
232 \fB\-X\fR
233 options extract a specific MIME section to a file or to a pipe to an external program\&. Use the
234 \fB\-s\fR
235 option to identify the MIME section to extract\&. If the
236 \fB\-s\fR
237 option is not specified, every MIME section in the message is extracted, one at a time\&. If
238 \fB\-s\fR
239 lists multiple sections, each section gets extracted separately\&.
240 quoted\-printable
241 and
242 base64
243 encoding are automatically decoded\&.
244 .PP
245 \-x
246 .RS 4
247 Interactive extraction\&.
248 \fBreformime\fR
249 prints the MIME content type of each section\&. Answer with \*(Aqy\*(Aq or \*(AqY\*(Aq to extract the MIME section\&. Specify the filename at the next prompt\&.
250 \fBreformime\fR
251 prompts with a default filename\&.
252 \fBreformime\fR
253 tries to choose the default filename based on the MIME headers, if possible\&. If not, the default filename will be
254 attachment1\&.dat
255 (if the \-s option is not specified, the next filename will be
256 attachment2\&.dat, and so on)\&.
257 .RE
258 .PP
259 \-x\fIPREFIX\fR
260 .RS 4
261 Automatic extraction\&.
262 \fBreformime\fR
263 automatically extracts one or more MIME sections, and saves them to a file\&. The filename is formed by taking
264 \fIPREFIX\fR, and appending the default filename to it\&. Note that there\*(Aqs no space between "\-x" and "PREFIX"\&. For example:
265 .sp
266 .if n \{\
267 .RS 4
268 .\}
269 .nf
270 reformime \-xfiles\-
271 .fi
272 .if n \{\
273 .RE
274 .\}
275 This command saves MIME sections as
276 files\-attachment1\&.dat, then
277 files\-attachment2\&.dat, etc\&.
278 \fBreformime\fR
279 tries to append the filename specified in the MIME headers for each section, where possible\&.
280 \fBreformime\fR
281 replaces all suspect characters with the underscore character\&.
282 .RE
283 .PP
284 \-X prog arg1 arg2 \&.\&.\&.
285 .RS 4
286 The
287 \fB\-X\fR
288 option must be the last option to
289 \fBreformime\fR\&.
290 \fBreformime\fR
291 runs an external program
292 \fBprog\fR, and pipes the contents of the MIME section to the program\&.
293 \fBreformime\fR
294 sets the environment variable
295 \fBCONTENT_TYPE\fR
296 to the MIME content type\&. The environment variable
297 \fBFILENAME\fR
298 gets set to the default filename of
299 \fBreformime\fR\*(Aqs liking\&. If the
300 \fB\-s\fR
301 option is not specified, the program runs once for every MIME section in the message\&. The external program,
302 \fBprog\fR
303 must terminate with a zero exit status in order for
304 \fBreformime\fR
305 to proceed to the next MIME section in the message (or the next section specified by
306 \fB\-s\fR)\&. In any case, if
307 \fBprog\fR
308 terminates with a non\-zero exit status,
309 \fBreformime\fR
310 terminates with the exit status of 20 plus
311 \fBprog\fR\*(Aqs exit status\&.
312 .RE
313 .if n \{\
314 .sp
315 .\}
316 .RS 4
317 .it 1 an-trap
318 .nr an-no-space-flag 1
319 .nr an-break-flag 1
320 .br
321 .ps +1
322 \fBNote\fR
323 .ps -1
324 .br
325 .PP
326 \fBreformime\fR
327 extracts every MIME section in the message unless the
328 \fB\-s\fR
329 option is specified\&. This includes even the
330 text/plain
331 MIME content that usually precedes a binary attachment\&.
332 .sp .5v
333 .RE
334 .SS "Adding RFC 2045 MIME headers"
335 .PP
336 The
337 \fB\-r\fR
338 option performs the following actions:
339 .PP
340 If there is no
341 Mime\-Version:,
342 Content\-Type:, or
343 Content\-Transfer\-Encoding:
344 header,
345 \fBreformime\fR
346 adds one\&.
347 .PP
348 If the
349 Content\-Transfer\-Encoding:
350 header contains
351 8bit
352 or
353 raw, but only seven\-bit data is found,
354 \fBreformime\fR
355 changes the
356 Content\-Transfer\-Encoding
357 header to
358 7bit\&.
359 .PP
360 \fB\-r7\fR
361 does the same thing, but also converts
362 8bit\-encoded content that contains eight\-bit characters to
363 quoted\-printable
364 encoding\&.
365 .PP
366 \fB\-r8\fR
367 does the same thing, but also converts
368 quoted\-printable\-encoded content to
369 8bit, except in some situations\&. The content remains
370 quoted\-printable
371 if converting it results in excessively long lines of text\&.
372 .PP
373 \fB\-rU\fR
374 always converts
375 quoted\-printable\-encoded content to
376 8bit
377 potentially resulting in excessively long lines of text\&. The resulting message should not be resubmitted for mail delivery, as a delivery failure may occur\&.
378 .SS "Creating multipart/digest MIME digests"
379 .PP
380 The
381 \fB\-m\fR
382 option creates a MIME digest\&.
383 \fBreformime\fR
384 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\&.
385 \fBreformime\fR
386 splices all files into a
387 \fBmultipart/digest\fR
388 MIME section, and writes it to standard output\&.
389 .SS "Translating MIME headers"
390 .PP
391 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\&.
392 .PP
393 \-h "\fIheader\fR"
394 .RS 4
395 Decode a MIME\-encoded "\fIheader\fR" and print the decoded 8\-bit content on standard output\&. The decoding gets carried out as if the contents occurred in the
396 \(lqSubject\(rq
397 header\&. Example:
398 .sp
399 .if n \{\
400 .RS 4
401 .\}
402 .nf
403 $ reformime \-h \*(Aq=?iso\-8859\-1?Q?H=F3la!?=\*(Aq
404 Hóla!
405 .fi
406 .if n \{\
407 .RE
408 .\}
409 .RE
410 .PP
411 \-H "\fIheader\fR"
412 .RS 4
413 Like
414 \fB\-h\fR
415 except that
416 \fIheader\fR
417 is parsed as a list of email addresses, like
418 \(lqFrom\(rq
419 or
420 \(lqTo\(rq\&.
421 .RE
422 .PP
423 \-o "\fItext\fR"
424 .RS 4
425 MIME\-encode "\fItext\fR", and print the results on standard output\&.
426 .RE
427 .PP
428 \-O "\fItext\fR"
429 .RS 4
430 Like the
431 \fB\-o option\fR, except that
432 \fItext\fR
433 is a structured header with RFC 2822 addresses\&.
434 .RE
435 .PP
436 \-c "\fIcharset\fR"
437 .RS 4
438 Use
439 \fIcharset\fR
440 as the character set setting, by the
441 \fB\-h\fR,
442 \fB\-H\fR,
443 \fB\-o\fR
444 and
445 \fB\-O\fR
446 options\&.
447 .RE
448 .PP
449 \-u
450 .RS 4
451 This
452 \(lqundocumented\(rq
453 option reads a MIME message on standard input, and converts its contents to an UTF\-8\-encoded character stream, which is written to standard output\&.
454 .sp
455 The standard output receives a concatenated amalgam of the headers and
456 \(lqtext\(rq
457 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
458 quoted\-printable
459 and
460 base64
461 transfer encodings of
462 \(lqtext\(rq
463 MIME objects\&.
464 .RE
465 .SH "SEE ALSO"
466 .PP
467 \m[blue]\fB\fBreformail\fR(1)\fR\m[]\&\s-2\u[3]\d\s+2,
468 \fBsendmail\fR(8),
469 \m[blue]\fB\fBmailbot\fR(1)\fR\m[]\&\s-2\u[4]\d\s+2,
470 \m[blue]\fB\fBmaildrop\fR(1)\fR\m[]\&\s-2\u[5]\d\s+2,
471 \m[blue]\fB\fBmaildropfilter\fR(5)\fR\m[]\&\s-2\u[6]\d\s+2,
472 \fBegrep\fR(1),
473 \fBgrep\fR(1),
474 \fBsendmail\fR(8)\&.
475 .SH "AUTHOR"
476 .PP
477 \fBSam Varshavchik\fR
478 .RS 4
479 Author
480 .RE
481 .SH "NOTES"
482 .IP " 1." 4
483 RFC 2045
484 .RS 4
485 \%http://www.rfc-editor.org/rfc/rfc2045.txt
486 .RE
487 .IP " 2." 4
488 RFC 1894
489 .RS 4
490 \%http://www.rfc-editor.org/rfc/rfc1894.txt
491 .RE
492 .IP " 3." 4
493 \fBreformail\fR(1)
494 .RS 4
495 \%http://www.courier-mta.org/maildrop/reformail.html
496 .RE
497 .IP " 4." 4
498 \fBmailbot\fR(1)
499 .RS 4
500 \%http://www.courier-mta.org/maildrop/mailbot.html
501 .RE
502 .IP " 5." 4
503 \fBmaildrop\fR(1)
504 .RS 4
505 \%http://www.courier-mta.org/maildrop/maildrop.html
506 .RE
507 .IP " 6." 4
508 \fBmaildropfilter\fR(5)
509 .RS 4
510 \%http://www.courier-mta.org/maildrop/maildropfilter.html
511 .RE