Debian Codegraph @

upstream/debian-unstable/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: 08/28/2025
8 .\" Manual: Double Precision, Inc.
9 .\" Source: Courier Mail Server
10 .\" Language: English
11 .\"
12 .TH "REFORMIME" "1" "08/28/2025" "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 3464\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 .sp
125 International domain names get converted to the system locale\*(Aqs 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\*(Aqs encoding should be UTF\-8\&.
126 .RE
127 .PP
128 \-D
129 .RS 4
130 Like the
131 \fB\-d\fR
132 except that
133 \fBreformime\fR
134 lists the address found in the
135 Original\-Recipient:
136 header, if it exists\&.
137 .RE
138 .PP
139 \-e
140 .RS 4
141 Extract the contents of the indicated MIME section, and display it on standard output\&. The
142 \fB\-s\fR
143 option is required when
144 \fB\-e\fR
145 is specified\&. If the specified section or sections use either the
146 base64
147 or
148 quoted\-printable
149 encoding method,
150 \fBreformime\fR
151 automatically decodes it\&. In this case you\*(Aqre better off redirecting the standard output into a file\&.
152 .RE
153 .PP
154 \-i
155 .RS 4
156 Display MIME information for each section\&.
157 \fBreformime\fR
158 displays the contents of the
159 Content\-Type:
160 header, any encoding used, and the character set\&.
161 \fBreformime\fR
162 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)\&.
163 .RE
164 .PP
165 \-V
166 .RS 4
167 Check for correctness of each section\*(Aqs MIME metadata\&. No output is produced when all MIME sections pass all tests\&. Any issues are reported, together with their MIME section, for example:
168 .sp
169 .if n \{\
170 .RS 4
171 .\}
172 .nf
173 Warnings (1\&.1):
174 Bad hexadecimal quoted\-printable encoding
175
176 .fi
177 .if n \{\
178 .RE
179 .\}
180 Warning messages indicate which MIME section they\*(Aqre reported for, section 1\&.1 in this example had a problem with its encoding\&.
181 .sp
182 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\*(Aqs worth)\&. Fatal errors result in
183 \fBreformime\fR
184 terminating with a non\-0 exit code\&.
185 .RE
186 .PP
187 \-m
188 .RS 4
189 Create a
190 multipart/digest
191 MIME message digest\&.
192 .RE
193 .PP
194 \-r
195 .RS 4
196 Rewrite message, adding or standardizing
197 \m[blue]\fBRFC 2045\fR\m[]\&\s-2\u[1]\d\s+2
198 MIME headers\&.
199 .RE
200 .PP
201 \-r7
202 .RS 4
203 Like
204 \fB\-r\fR
205 but also convert
206 8bit\-encoded MIME sections to
207 quoted\-printable\&.
208 .RE
209 .PP
210 \-r8
211 .RS 4
212 Like
213 \fB\-r\fR
214 but also convert
215 quoted\-printable\-encoded MIME sections to
216 8bit, except in some situations, see below\&.
217 .RE
218 .PP
219 \-rU
220 .RS 4
221 Unconditionally convert
222 quoted\-printable\-encoded MIME sections to
223 8bit, even when the resulting message may not necessarily comply with Internet message formatting standards\&. See below for more information\&.
224 .RE
225 .PP
226 \-s \fIsection\fR
227 .RS 4
228 Display MIME information for this section only\&.
229 \fIsection\fR
230 is a MIME specification tag\&. The
231 \fB\-s\fR
232 option is required if
233 \fB\-e\fR
234 is also specified, and is optional with
235 \fB\-i\fR\&.
236 .sp
237 Multiple sections may be specified by separating them with commas\&.
238 \fBreformime\fR
239 processes each section using the other options that were specified\&.
240 .RE
241 .PP
242 \-x
243 .RS 4
244 Extract the contents of the indicated MIME section to a file\&.
245 .RE
246 .PP
247 \-X
248 .RS 4
249 Pipe the contents of the indicated MIME section to a program\&.
250 .RE
251 .SS "Extracting RFC 2045 MIME section(s) to file(s)"
252 .PP
253 The
254 \fB\-x\fR
255 and
256 \fB\-X\fR
257 options extract a specific MIME section to a file or to a pipe to an external program\&. Use the
258 \fB\-s\fR
259 option to identify the MIME section to extract\&. If the
260 \fB\-s\fR
261 option is not specified, every MIME section in the message is extracted, one at a time\&. If
262 \fB\-s\fR
263 lists multiple sections, each section gets extracted separately\&.
264 quoted\-printable
265 and
266 base64
267 encoding are automatically decoded\&.
268 .PP
269 \-x
270 .RS 4
271 Interactive extraction\&.
272 \fBreformime\fR
273 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\&.
274 \fBreformime\fR
275 prompts with a default filename\&.
276 \fBreformime\fR
277 tries to choose the default filename based on the MIME headers, if possible\&. If not, a randomly\-generated filename is the default option\&.
278 .RE
279 .PP
280 \-x\fIPREFIX\fR
281 .RS 4
282 Automatic extraction\&.
283 \fBreformime\fR
284 automatically extracts one or more MIME sections, and saves them to a file\&. The filename is formed by taking
285 \fIPREFIX\fR, and appending the default filename to it\&. Note that there\*(Aqs no space between "\-x" and "PREFIX"\&. For example:
286 .sp
287 .if n \{\
288 .RS 4
289 .\}
290 .nf
291 reformime \-xfiles\-
292 .fi
293 .if n \{\
294 .RE
295 .\}
296 This command saves MIME sections as
297 files\-attachment1\&.dat, then
298 files\-attachment2\&.dat, etc\&.
299 \fBreformime\fR
300 tries to append the filename specified in the MIME headers for each section, where possible\&.
301 \fBreformime\fR
302 replaces all suspect characters with the underscore character\&.
303 .RE
304 .PP
305 \-X prog arg1 arg2 \&.\&.\&.
306 .RS 4
307 The
308 \fB\-X\fR
309 option must be the last option to
310 \fBreformime\fR\&.
311 \fBreformime\fR
312 runs an external program
313 \fBprog\fR, and pipes the contents of the MIME section to the program\&.
314 \fBreformime\fR
315 sets the environment variable
316 \fBCONTENT_TYPE\fR
317 to the MIME content type\&. The environment variable
318 \fBFILENAME\fR
319 gets set to the default filename of
320 \fBreformime\fR\*(Aqs liking\&. If the
321 \fB\-s\fR
322 option is not specified, the program runs once for every MIME section in the message\&. The external program,
323 \fBprog\fR
324 must terminate with a zero exit status in order for
325 \fBreformime\fR
326 to proceed to the next MIME section in the message (or the next section specified by
327 \fB\-s\fR)\&. In any case, if
328 \fBprog\fR
329 terminates with a non\-zero exit status,
330 \fBreformime\fR
331 terminates with the exit status of 20 plus
332 \fBprog\fR\*(Aqs exit status\&.
333 .RE
334 .if n \{\
335 .sp
336 .\}
337 .RS 4
338 .nr an-no-space-flag 1
339 .nr an-break-flag 1
340 .br
341 .ps +1
342 \fBNote\fR
343 .ps -1
344 .br
345 .PP
346 \fBreformime\fR
347 extracts every MIME section in the message unless the
348 \fB\-s\fR
349 option is specified\&. This includes even the
350 text/plain
351 MIME content that usually precedes a binary attachment\&.
352 .sp .5v
353 .RE
354 .SS "Adding RFC 2045 MIME headers"
355 .PP
356 The
357 \fB\-r\fR
358 option performs the following actions:
359 .PP
360 If there is no
361 Mime\-Version:,
362 Content\-Type:, or
363 Content\-Transfer\-Encoding:
364 header,
365 \fBreformime\fR
366 adds one\&.
367 .PP
368 If the
369 Content\-Transfer\-Encoding:
370 header contains
371 8bit
372 or
373 raw, but only seven\-bit data is found,
374 \fBreformime\fR
375 changes the
376 Content\-Transfer\-Encoding
377 header to
378 7bit\&.
379 .PP
380 \fB\-r7\fR
381 does the same thing, but also converts
382 8bit\-encoded content that contains eight\-bit characters to
383 quoted\-printable
384 encoding\&.
385 .PP
386 \fB\-r8\fR
387 does the same thing, but also converts
388 quoted\-printable\-encoded content to
389 8bit, except in some situations\&. The content remains
390 quoted\-printable
391 if converting it results in excessively long lines of text\&.
392 .PP
393 \fB\-rU\fR
394 always converts
395 quoted\-printable\-encoded content to
396 8bit
397 potentially resulting in excessively long lines of text\&. The resulting message should not be resubmitted for mail delivery, as a delivery failure may occur\&.
398 .SS "Creating multipart/digest MIME digests"
399 .PP
400 The
401 \fB\-m\fR
402 option creates a MIME digest\&.
403 \fBreformime\fR
404 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\&.
405 \fBreformime\fR
406 splices all files into a
407 \fBmultipart/digest\fR
408 MIME section, and writes it to standard output\&.
409 .SS "Translating MIME headers"
410 .PP
411 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\&.
412 .PP
413 \-h "\fIheader\fR"
414 .RS 4
415 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
416 \(lqSubject\(rq
417 header\&. Example:
418 .sp
419 .if n \{\
420 .RS 4
421 .\}
422 .nf
423 $ reformime \-h \*(Aq=?iso\-8859\-1?Q?H=F3la!?=\*(Aq
424 Hóla!
425 .fi
426 .if n \{\
427 .RE
428 .\}
429 .RE
430 .PP
431 \-H "\fIheader\fR"
432 .RS 4
433 Like
434 \fB\-h\fR
435 except that
436 \fIheader\fR
437 is parsed as a list of email addresses, like
438 \(lqFrom\(rq
439 or
440 \(lqTo\(rq\&.
441 .RE
442 .PP
443 \-o "\fItext\fR"
444 .RS 4
445 MIME\-encode "\fItext\fR", and print the results on standard output\&.
446 .RE
447 .PP
448 \-O "\fItext\fR"
449 .RS 4
450 Like the
451 \fB\-o option\fR, except that
452 \fItext\fR
453 is a structured header with RFC 2822 addresses\&.
454 .RE
455 .PP
456 \-c "\fIcharset\fR"
457 .RS 4
458 Use
459 \fIcharset\fR
460 as the character set setting, by the
461 \fB\-h\fR,
462 \fB\-H\fR,
463 \fB\-o\fR
464 and
465 \fB\-O\fR
466 options\&.
467 .RE
468 .PP
469 \-u
470 .RS 4
471 This
472 \(lqundocumented\(rq
473 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\&.
474 .sp
475 The standard output receives a concatenated amalgam of the headers and
476 \(lqtext\(rq
477 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
478 quoted\-printable
479 and
480 base64
481 transfer encodings of
482 \(lqtext\(rq
483 MIME objects\&. An extra newline character is appended to each MIME entity, ensuring that MIME entities that don\*(Aqt end with a trailing newline will not end up having the next MIME entity\*(Aqs first header line glued to it\&.
484 .RE
485 .SH "SEE ALSO"
486 .PP
487 \m[blue]\fB\fBreformail\fR(1)\fR\m[]\&\s-2\u[3]\d\s+2,
488 \fBsendmail\fR(8),
489 \m[blue]\fB\fBmailbot\fR(1)\fR\m[]\&\s-2\u[4]\d\s+2,
490 \m[blue]\fB\fBmaildrop\fR(1)\fR\m[]\&\s-2\u[5]\d\s+2,
491 \m[blue]\fB\fBmaildropfilter\fR(5)\fR\m[]\&\s-2\u[6]\d\s+2,
492 \fBegrep\fR(1),
493 \fBgrep\fR(1),
494 \fBsendmail\fR(8)\&.
495 .SH "AUTHOR"
496 .PP
497 \fBSam Varshavchik\fR
498 .RS 4
499 Author
500 .RE
501 .SH "NOTES"
502 .IP " 1." 4
503 RFC 2045
504 .RS 4
505 \%http://www.rfc-editor.org/rfc/rfc2045.txt
506 .RE
507 .IP " 2." 4
508 RFC 3464
509 .RS 4
510 \%https://www.rfc-editor.org/rfc/rfc3464.txt
511 .RE
512 .IP " 3." 4
513 \fBreformail\fR(1)
514 .RS 4
515 \%http://www.courier-mta.org/maildrop/reformail.html
516 .RE
517 .IP " 4." 4
518 \fBmailbot\fR(1)
519 .RS 4
520 \%http://www.courier-mta.org/maildrop/mailbot.html
521 .RE
522 .IP " 5." 4
523 \fBmaildrop\fR(1)
524 .RS 4
525 \%http://www.courier-mta.org/maildrop/maildrop.html
526 .RE
527 .IP " 6." 4
528 \fBmaildropfilter\fR(5)
529 .RS 4
530 \%http://www.courier-mta.org/maildrop/maildropfilter.html
531 .RE