1 .TH MHFIXMSG %manext1% "March 21, 2013" "%nmhversion%"
6 mhfixmsg \- rewrite MIME messages with various transformations
18 .RB "| " \-notextcodeset ]
19 .RB [ \-reformat " | " \-noreformat ]
20 .RB [ \-fixboundary " | " \-nofixboundary ]
21 .RB [ \-fixcte " | " \-nofixcte ]
29 .RB [ \-verbose " | " \-noverbose ]
35 rewrites MIME messages, applying specific transformations such as
36 decoding of MIME-encoded message parts and repairing invalid MIME
39 MIME messages are specified in RFC\-2045 to RFC\-2049
44 command is invaluable for viewing the content structure of MIME
47 passes non-MIME messages through without any transformations. If no
48 transformations apply to a MIME message, the original message or file
49 is not modified or removed.
53 switch enables a transformation to decode each base64 and
54 quoted-printable text message part to the selected 8bit or 7bit
55 encoding. If 7bit is selected for a base64 part but it will only fit
56 8bit, as defined by RFC-2045, then it will be decoded to 8bit
57 quoted-printable. Otherwise, if the decoded text would not fit the
58 selected encoding, the part is not decoded (and a message will be
65 switch specifies that all text/plain parts of the message(s)
66 should be converted to
68 Codeset conversions require that
72 To convert text parts other than text/plain, an external program can
79 switch enables a transformation for text parts in the message. For
80 each text part that is not text/plain and that does not have a
81 corresponding text/plain in a multipart/alternative part,
83 looks for a mhfixmsg-format-text/subtype profile entry that matches
84 the subtype of the part. If one is found and can be used to
85 successfully convert the part to text/plain,
87 inserts that text/plain part at the beginning of the containing
88 multipart/alternative part, if present. If not, it creates a
89 multipart/alternative part.
92 requires a profile entry for each text part subtype to be reformatted.
93 The mhfixmsg-format-text/subtype profile entries are based on external
94 conversion programs, and are used the same way that
96 uses its mhshow-show-text/subtype entries. When
98 is installed, it searches for a conversion program for text/html
99 content, and if one is found, inserts a mhfixmsg-format-text/html
100 entry in %etcdir%/mhn.defaults. An entry of the same name in the
101 user's profile takes precedence. The user can add entries for
102 other text subtypes to their profile.
106 switch enables a transformation to repair the boundary portion of the
107 Content-Type header field of the message to match the boundaries of
108 the outermost multipart part of the message, if it does not. That
109 condition is indicated by a \*(lqbogus multipart content in
110 message\*(rq error message from
114 programs that parse MIME messages.
118 switch enables a transformation to change the
119 Content-Transfer-Encoding from an invalid value to 8bit in message
120 parts with a Content-Type of multipart, as required by RFC 2045,
121 Section 6.4. That condition is indicated by a \*(lqmust be encoded in
122 7bit, 8bit, or binary\*(rq error message from
126 programs that parse MIME messages.
132 to output informational message for each transformation applied.
140 file as the source message, rather than a message from a folder.
141 If this file is \*(lq-\*(rq, then
143 accepts the source message on the standard input stream. If
146 switch is not enabled when using the standard input stream,
148 will not produce a transformed output message.
151 by default, transforms the message in place. If the
153 switch is enabled, then
155 does not modify the input message or file, but instead places its
156 output in the specified file. An outfile name of \*(lq-\*(rq
157 specifies the standard output stream.
163 switch can be used to show what transformations
165 would apply without actually applying them, e.g.,
168 mhfixmsg -outfile /dev/null -verbose
171 As always, this usage obeys any
173 switches in the user's profile.
178 to add a single transformed message to a different folder, e.g.,
181 mhfixmsg -outfile - | \\
183 %libdir%/rcvstore +folder
186 .SS Summary of Applicability
187 The transformations apply to the parts of a message depending on
188 content type and/or encoding as follows:
192 .ta \w'\-fixboundary 'u
193 \-decodetext base64 and quoted-printable encoded text parts
194 \-textcodeset text/plain parts
195 \-reformat text parts that are not text/plain
196 \-fixboundary outermost multipart part
197 \-fixcte multipart part
201 .SS "Backup of Original Message/File"
202 If it applies any transformations to a message or file,
207 backs up the original the same way as
211 profile component, if present. If not present,
213 moves the original message to a backup file.
216 switch may be used to override this profile component. The
218 switch disables the use of any
220 profile component and negates all prior
224 .SS "Integration with procmail"
225 By way of example, here is an excerpt from a procmailrc file
226 that filters messages through
228 before storing them in the user's
230 folder. It also stores the incoming message in the
232 folder in a filename generated by
234 which is a non-POSIX utility to generate a temporary file.
235 If you do not have that utility, then the
237 function could form the basis for a substitute. Or,
239 could be called on the message after it is stored.
243 .ta \w'\-fixboundary 'u
244 PATH = %bindir%:$PATH
245 MAILDIR = `mhparam path`
246 MKTEMP = 'mktemp Backups/mhfixmsg.XXXXXXXX'
247 MHFIXMSG = 'mhfixmsg -noverbose -file - -outfile -'
248 STORE = %libdir%/rcvstore
250 :0 w: nmh-worker/procmail.$LOCKEXT
251 * ^TOnmh-workers@nongnu.org
252 | tee `$MKTEMP` | $MHFIXMSG | $STORE +nmh-workers
258 looks for mhn.defaults in multiple locations: absolute pathnames are
259 accessed directly, tilde expansion is done on usernames, and files are
260 searched for in the user's
262 directory as specified in their profile. If not found there, the directory
263 .RI \*(lq %etcdir% \*(rq
268 .ta \w'%etcdir%/mhn.defaults 'u
269 ^$HOME/\&.mh\(ruprofile~^The user profile
270 ^%etcdir%/mhn.defaults~^Default mhfixmsg conversion entries
272 .SH "PROFILE COMPONENTS"
276 .ta \w'ExtraBigProfileName 'u
277 ^Path:~^To determine the user's nmh directory
278 ^Current\-Folder:~^To find the default current folder
279 ^rmmproc:~^Program to delete original messages or files
293 .RB ` +folder "' defaults to the current folder"
294 .RB ` msgs "' defaults to cur"
295 .RB ` "\-decodetext 8bit"'
296 .RB ` \-notextcodeset '
298 .RB ` \-fixboundary '
303 If a folder is given, it will become the current folder. The last
304 message selected from a folder will become the current message. If
307 switch is used, the context will not be modified.