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 ASCII-encoded text parts.
71 switch specifies that all text/plain parts of the message(s)
72 should be converted to
74 Codeset conversions require that
78 To convert text parts other than text/plain, an external program can
85 switch enables a transformation for text parts in the message. For
86 each text part that is not text/plain and that does not have a
87 corresponding text/plain in a multipart/alternative part,
89 looks for a mhfixmsg-format-text/subtype profile entry that matches
90 the subtype of the part. If one is found and can be used to
91 successfully convert the part to text/plain,
93 inserts that text/plain part at the beginning of the containing
94 multipart/alternative part, if present. If not, it creates a
95 multipart/alternative part.
99 switch broadens the applicability of
101 by always replacing a corresponding text/plain part, if one exists.
104 if enabled, the replacement will be shown as two steps: a removal of
105 the text/plain part followed by the usual insertion of a new part.
108 requires a profile entry for each text part subtype to be reformatted.
109 The mhfixmsg-format-text/subtype profile entries are based on external
110 conversion programs, and are used the same way that
112 uses its mhshow-show-text/subtype entries. When
114 is installed, it searches for a conversion program for text/html
115 content, and if one is found, inserts a mhfixmsg-format-text/html
116 entry in %etcdir%/mhn.defaults. An entry of the same name in the
117 user's profile takes precedence. The user can add entries for
118 other text subtypes to their profile.
122 switch enables a transformation to repair the boundary portion of the
123 Content-Type header field of the message to match the boundaries of
124 the outermost multipart part of the message, if it does not. That
125 condition is indicated by a \*(lqbogus multipart content in
126 message\*(rq error message from
130 programs that parse MIME messages.
134 switch enables a transformation to change the
135 Content-Transfer-Encoding from an invalid value to 8bit in message
136 parts with a Content-Type of multipart, as required by RFC 2045,
137 Section 6.4. That condition is indicated by a \*(lqmust be encoded in
138 7bit, 8bit, or binary\*(rq error message from
142 programs that parse MIME messages.
148 to output informational message for each transformation applied.
156 file as the source message, rather than a message from a folder.
157 If this file is \*(lq-\*(rq, then
159 accepts the source message on the standard input stream. If
162 switch is not enabled when using the standard input stream,
164 will not produce a transformed output message.
167 by default, transforms the message in place. If the
169 switch is enabled, then
171 does not modify the input message or file, but instead places its
172 output in the specified file. An outfile name of \*(lq-\*(rq
173 specifies the standard output stream.
179 switch can be used to show what transformations
181 would apply without actually applying them, e.g.,
184 mhfixmsg -outfile /dev/null -verbose
187 As always, this usage obeys any
189 switches in the user's profile.
194 to add a single transformed message to a different folder, e.g.,
197 mhfixmsg -outfile - | \\
199 %libdir%/rcvstore +folder
202 .SS Summary of Applicability
203 The transformations apply to the parts of a message depending on
204 content type and/or encoding as follows:
208 .ta \w'\-fixboundary 'u
209 \-decodetext base64 and quoted-printable encoded text parts
210 \-textcodeset text/plain parts
211 \-reformat text parts that are not text/plain
212 \-fixboundary outermost multipart part
213 \-fixcte multipart part
217 .SS "Backup of Original Message/File"
218 If it applies any transformations to a message or file,
223 backs up the original the same way as
227 profile component, if present. If not present,
229 moves the original message to a backup file.
232 switch may be used to override this profile component. The
234 switch disables the use of any
236 profile component and negates all prior
240 .SS "Integration with procmail"
241 By way of example, here is an excerpt from a procmailrc file
242 that filters messages through
244 before storing them in the user's
246 folder. It also stores the incoming message in the
248 folder in a filename generated by
250 which is a non-POSIX utility to generate a temporary file.
251 If you do not have that utility, then the
253 function could form the basis for a substitute. Or,
255 could be called on the message after it is stored.
259 .ta \w'\-fixboundary 'u
260 PATH = %bindir%:$PATH
261 MAILDIR = `mhparam path`
262 MKTEMP = 'mktemp Backups/mhfixmsg.XXXXXXXX'
263 MHFIXMSG = 'mhfixmsg -noverbose -file - -outfile -'
264 STORE = %libdir%/rcvstore
266 :0 w: nmh-worker/procmail.$LOCKEXT
267 * ^TOnmh-workers@nongnu.org
268 | tee `$MKTEMP` | $MHFIXMSG | $STORE +nmh-workers
274 looks for mhn.defaults in multiple locations: absolute pathnames are
275 accessed directly, tilde expansion is done on usernames, and files are
276 searched for in the user's
278 directory as specified in their profile. If not found there, the directory
279 .RI \*(lq %etcdir% \*(rq
284 .ta \w'%etcdir%/mhn.defaults 'u
285 ^$HOME/\&.mh\(ruprofile~^The user profile
286 ^%etcdir%/mhn.defaults~^Default mhfixmsg conversion entries
288 .SH "PROFILE COMPONENTS"
292 .ta \w'ExtraBigProfileName 'u
293 ^Path:~^To determine the user's nmh directory
294 ^Current\-Folder:~^To find the default current folder
295 ^rmmproc:~^Program to delete original messages or files
309 .RB ` +folder "' defaults to the current folder"
310 .RB ` msgs "' defaults to cur"
311 .RB ` "\-decodetext 8bit"'
312 .RB ` \-notextcodeset '
314 .RB ` \-noreplacetextplain '
315 .RB ` \-fixboundary '
320 If a folder is given, it will become the current folder. The last
321 message selected from a folder will become the current message. If
324 switch is used, the context will not be modified.