1 .TH MHFIXMSG %manext1% "May 4, 2013" "%nmhversion%"
6 mhfixmsg \- rewrite MIME messages with various transformations
18 .RB "| " \-notextcodeset ]
19 .RB [ \-reformat " | " \-noreformat ]
20 .RB [ \-replacetextplain " | " \-noreplacetextplain ]
21 .RB [ \-fixboundary " | " \-nofixboundary ]
22 .RB [ \-fixcte " | " \-nofixcte ]
30 .RB [ \-verbose " | " \-noverbose ]
36 rewrites MIME messages, applying specific transformations such as
37 decoding of MIME-encoded message parts and repairing invalid MIME
40 MIME messages are specified in RFC 2045 to RFC 2049
45 command is invaluable for viewing the content structure of MIME
48 passes non-MIME messages through without any transformations. If no
49 transformations apply to a MIME message, the original message or file
50 is not modified or removed.
54 switch enables a transformation to decode each base64 and
55 quoted-printable text message part to the selected 8bit or 7bit
56 encoding. If 7bit is selected for a base64 part but it will only fit
57 8bit, as defined by RFC 2045, then it will be decoded to 8bit
58 quoted-printable. Otherwise, if the decoded text would not fit the
59 selected encoding, the part is not decoded (and a message will be
66 switch is enabled, each carriage return character that precedes a
67 linefeed character is removed from text parts encoded in ASCII,
68 ISO-8859-x, UTF-8, or Windows-12xx.
72 switch specifies that all text/plain parts of the message(s)
73 should be converted to
75 Codeset conversions require that
79 To convert text parts other than text/plain, an external program can
86 switch enables a transformation for text parts in the message. For
87 each text part that is not text/plain and that does not have a
88 corresponding text/plain in a multipart/alternative part,
90 looks for a mhfixmsg-format-text/subtype profile entry that matches
91 the subtype of the part. If one is found and can be used to
92 successfully convert the part to text/plain,
94 inserts that text/plain part at the beginning of the containing
95 multipart/alternative part, if present. If not, it creates a
96 multipart/alternative part.
100 switch broadens the applicability of
102 by always replacing a corresponding text/plain part, if one exists.
105 if enabled, the replacement will be shown as two steps: a removal of
106 the text/plain part followed by the usual insertion of a new part.
109 requires a profile entry for each text part subtype to be reformatted.
110 The mhfixmsg-format-text/subtype profile entries are based on external
111 conversion programs, and are used the same way that
113 uses its mhshow-show-text/subtype entries. When
115 is installed, it searches for a conversion program for text/html
116 content, and if one is found, inserts a mhfixmsg-format-text/html
117 entry in %etcdir%/mhn.defaults. An entry of the same name in the
118 user's profile takes precedence. The user can add entries for
119 other text subtypes to their profile.
123 switch enables a transformation to repair the boundary portion of the
124 Content-Type header field of the message to match the boundaries of
125 the outermost multipart part of the message, if it does not. That
126 condition is indicated by a \*(lqbogus multipart content in
127 message\*(rq error message from
131 programs that parse MIME messages.
135 switch enables a transformation to change the
136 Content-Transfer-Encoding from an invalid value to 8bit in message
137 parts with a Content-Type of multipart, as required by RFC 2045,
138 Section 6.4. That condition is indicated by a \*(lqmust be encoded in
139 7bit, 8bit, or binary\*(rq error message from
143 programs that parse MIME messages.
149 to output informational message for each transformation applied.
157 file as the source message, rather than a message from a folder.
158 If this file is \*(lq-\*(rq, then
160 accepts the source message on the standard input stream. If
163 switch is not enabled when using the standard input stream,
165 will not produce a transformed output message.
168 by default, transforms the message in place. If the
170 switch is enabled, then
172 does not modify the input message or file, but instead places its
173 output in the specified file. An outfile name of \*(lq-\*(rq
174 specifies the standard output stream.
180 switch can be used to show what transformations
182 would apply without actually applying them, e.g.,
185 mhfixmsg -outfile /dev/null -verbose
188 As always, this usage obeys any
190 switches in the user's profile.
195 to add a single transformed message to a different folder, e.g.,
198 mhfixmsg -outfile - | \\
200 %libdir%/rcvstore +folder
203 .SS Summary of Applicability
204 The transformations apply to the parts of a message depending on
205 content type and/or encoding as follows:
209 .ta \w'\-fixboundary 'u
210 \-decodetext base64 and quoted-printable encoded text parts
211 \-textcodeset text/plain parts
212 \-reformat text parts that are not text/plain
213 \-fixboundary outermost multipart part
214 \-fixcte multipart part
218 .SS "Backup of Original Message/File"
219 If it applies any transformations to a message or file,
224 backs up the original the same way as
228 profile component, if present. If not present,
230 moves the original message to a backup file.
233 switch may be used to override this profile component. The
235 switch disables the use of any
237 profile component and negates all prior
241 .SS "Integration with procmail"
242 By way of example, here is an excerpt from a procmailrc file
243 that filters messages through
245 before storing them in the user's
247 folder. It also stores the incoming message in the
249 folder in a filename generated by
251 which is a non-POSIX utility to generate a temporary file.
252 If you do not have that utility, then the
254 function could form the basis for a substitute. Or,
256 could be called on the message after it is stored.
260 .ta \w'\-fixboundary 'u
261 PATH = %bindir%:$PATH
262 MAILDIR = `mhparam path`
263 MKTEMP = 'mktemp Backups/mhfixmsg.XXXXXXXX'
264 MHFIXMSG = 'mhfixmsg -noverbose -file - -outfile -'
265 STORE = %libdir%/rcvstore
267 :0 w: nmh-worker/procmail.$LOCKEXT
268 * ^TOnmh-workers@nongnu.org
269 | tee `$MKTEMP` | $MHFIXMSG | $STORE +nmh-workers
275 looks for mhn.defaults in multiple locations: absolute pathnames are
276 accessed directly, tilde expansion is done on usernames, and files are
277 searched for in the user's
279 directory as specified in their profile. If not found there, the directory
280 .RI \*(lq %etcdir% \*(rq
285 .ta \w'%etcdir%/mhn.defaults 'u
286 ^$HOME/\&.mh\(ruprofile~^The user profile
287 ^%etcdir%/mhn.defaults~^Default mhfixmsg conversion entries
289 .SH "PROFILE COMPONENTS"
293 .ta \w'ExtraBigProfileName 'u
294 ^Path:~^To determine the user's nmh directory
295 ^Current\-Folder:~^To find the default current folder
296 ^rmmproc:~^Program to delete original messages or files
310 .RB ` +folder "' defaults to the current folder"
311 .RB ` msgs "' defaults to cur"
312 .RB ` "\-decodetext 8bit"'
313 .RB ` \-notextcodeset '
315 .RB ` \-noreplacetextplain '
316 .RB ` \-fixboundary '
321 If a folder is given, it will become the current folder. The last
322 message selected from a folder will become the current message. If
325 switch is used, the context will not be modified.