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 [ \-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 is enabled, each carriage return character that precedes a
66 linefeed character is removed from ASCII-encoded text parts.
70 switch specifies that all text/plain parts of the message(s)
71 should be converted to
73 Codeset conversions require that
77 To convert text parts other than text/plain, an external program can
84 switch enables a transformation for text parts in the message. For
85 each text part that is not text/plain and that does not have a
86 corresponding text/plain in a multipart/alternative part,
88 looks for a mhfixmsg-format-text/subtype profile entry that matches
89 the subtype of the part. If one is found and can be used to
90 successfully convert the part to text/plain,
92 inserts that text/plain part at the beginning of the containing
93 multipart/alternative part, if present. If not, it creates a
94 multipart/alternative part.
97 requires a profile entry for each text part subtype to be reformatted.
98 The mhfixmsg-format-text/subtype profile entries are based on external
99 conversion programs, and are used the same way that
101 uses its mhshow-show-text/subtype entries. When
103 is installed, it searches for a conversion program for text/html
104 content, and if one is found, inserts a mhfixmsg-format-text/html
105 entry in %etcdir%/mhn.defaults. An entry of the same name in the
106 user's profile takes precedence. The user can add entries for
107 other text subtypes to their profile.
111 switch enables a transformation to repair the boundary portion of the
112 Content-Type header field of the message to match the boundaries of
113 the outermost multipart part of the message, if it does not. That
114 condition is indicated by a \*(lqbogus multipart content in
115 message\*(rq error message from
119 programs that parse MIME messages.
123 switch enables a transformation to change the
124 Content-Transfer-Encoding from an invalid value to 8bit in message
125 parts with a Content-Type of multipart, as required by RFC 2045,
126 Section 6.4. That condition is indicated by a \*(lqmust be encoded in
127 7bit, 8bit, or binary\*(rq error message from
131 programs that parse MIME messages.
137 to output informational message for each transformation applied.
145 file as the source message, rather than a message from a folder.
146 If this file is \*(lq-\*(rq, then
148 accepts the source message on the standard input stream. If
151 switch is not enabled when using the standard input stream,
153 will not produce a transformed output message.
156 by default, transforms the message in place. If the
158 switch is enabled, then
160 does not modify the input message or file, but instead places its
161 output in the specified file. An outfile name of \*(lq-\*(rq
162 specifies the standard output stream.
168 switch can be used to show what transformations
170 would apply without actually applying them, e.g.,
173 mhfixmsg -outfile /dev/null -verbose
176 As always, this usage obeys any
178 switches in the user's profile.
183 to add a single transformed message to a different folder, e.g.,
186 mhfixmsg -outfile - | \\
188 %libdir%/rcvstore +folder
191 .SS Summary of Applicability
192 The transformations apply to the parts of a message depending on
193 content type and/or encoding as follows:
197 .ta \w'\-fixboundary 'u
198 \-decodetext base64 and quoted-printable encoded text parts
199 \-textcodeset text/plain parts
200 \-reformat text parts that are not text/plain
201 \-fixboundary outermost multipart part
202 \-fixcte multipart part
206 .SS "Backup of Original Message/File"
207 If it applies any transformations to a message or file,
212 backs up the original the same way as
216 profile component, if present. If not present,
218 moves the original message to a backup file.
221 switch may be used to override this profile component. The
223 switch disables the use of any
225 profile component and negates all prior
229 .SS "Integration with procmail"
230 By way of example, here is an excerpt from a procmailrc file
231 that filters messages through
233 before storing them in the user's
235 folder. It also stores the incoming message in the
237 folder in a filename generated by
239 which is a non-POSIX utility to generate a temporary file.
240 If you do not have that utility, then the
242 function could form the basis for a substitute. Or,
244 could be called on the message after it is stored.
248 .ta \w'\-fixboundary 'u
249 PATH = %bindir%:$PATH
250 MAILDIR = `mhparam path`
251 MKTEMP = 'mktemp Backups/mhfixmsg.XXXXXXXX'
252 MHFIXMSG = 'mhfixmsg -noverbose -file - -outfile -'
253 STORE = %libdir%/rcvstore
255 :0 w: nmh-worker/procmail.$LOCKEXT
256 * ^TOnmh-workers@nongnu.org
257 | tee `$MKTEMP` | $MHFIXMSG | $STORE +nmh-workers
263 looks for mhn.defaults in multiple locations: absolute pathnames are
264 accessed directly, tilde expansion is done on usernames, and files are
265 searched for in the user's
267 directory as specified in their profile. If not found there, the directory
268 .RI \*(lq %etcdir% \*(rq
273 .ta \w'%etcdir%/mhn.defaults 'u
274 ^$HOME/\&.mh\(ruprofile~^The user profile
275 ^%etcdir%/mhn.defaults~^Default mhfixmsg conversion entries
277 .SH "PROFILE COMPONENTS"
281 .ta \w'ExtraBigProfileName 'u
282 ^Path:~^To determine the user's nmh directory
283 ^Current\-Folder:~^To find the default current folder
284 ^rmmproc:~^Program to delete original messages or files
298 .RB ` +folder "' defaults to the current folder"
299 .RB ` msgs "' defaults to cur"
300 .RB ` "\-decodetext 8bit"'
301 .RB ` \-notextcodeset '
303 .RB ` \-fixboundary '
308 If a folder is given, it will become the current folder. The last
309 message selected from a folder will become the current message. If
312 switch is used, the context will not be modified.