1 .TH MHFIXMSG %manext1% "March 18, 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 the decoded text would not fit the selected encoding as
56 defined by RFC-2045, the part is not decoded.
60 switch specifies that all text/plain parts of the message(s)
61 should be converted to
63 Codeset conversions require that
67 To convert text parts other than text/plain, an external program can
74 switch enables a transformation for text parts in the message. For
75 each text part that is not text/plain and that does not have a
76 corresponding text/plain in a multipart/alternative part,
78 looks for a mhfixmsg-format-text/subtype profile entry that matches
79 the subtype of the part. If one is found and can be used to
80 successfully convert the part to text/plain,
82 inserts that text/plain part at the beginning of the containing
83 multipart/alternative part, if present. If not, it creates a
84 multipart/alternative part.
87 requires a profile entry for each text part subtype to be reformatted.
88 The mhfixmsg-format-text/subtype profile entries are based on external
89 conversion programs, and are used the same way that
91 uses its mhshow-show-text/subtype entries. When
93 is installed, it searches for a conversion program for text/html
94 content, and if one is found, inserts a mhfixmsg-format-text/html
95 entry in %etcdir%/mhn.defaults. An entry of the same name in the
96 user's profile takes precedence. The user can add entries for
97 other text subtypes to their profile.
101 switch enables a transformation to repair the boundary portion of the
102 Content-Type header field of the message to match the boundaries of
103 the outermost multipart part of the message, if it does not. That
104 condition is indicated by a \*(lqbogus multipart content in
105 message\*(rq error message from
109 programs that parse MIME messages.
113 switch enables a transformation to change the
114 Content-Transfer-Encoding from an invalid value to 8bit in message
115 parts with a Content-Type of multipart, as required by RFC 2045,
116 Section 6.4. That condition is indicated by a \*(lqmust be encoded in
117 7bit, 8bit, or binary\*(rq error message from
121 programs that parse MIME messages.
127 to output informational message for each transformation applied.
135 file as the source message, rather than a message from a folder.
136 If this file is \*(lq-\*(rq, then
138 accepts the source message on the standard input stream. If
141 switch is not enabled when using the standard input stream,
143 will not produce a transformed output message.
146 by default, transforms the message in place. If the
148 switch is enabled, then
150 does not modify the input message or file, but instead places its
151 output in the specified file. An outfile name of \*(lq-\*(rq
152 specifies the standard output stream.
158 switch can be used to show what transformations
160 would apply without actually applying them, e.g.,
163 mhfixmsg -outfile /dev/null -verbose
166 As always, this usage obeys any
168 switches in the user's profile.
173 to add a single transformed message to a different folder, e.g.,
176 mhfixmsg -outfile - | \\
178 %libdir%/rcvstore +folder
181 .SS Summary of Applicability
182 The transformations apply to the parts of a message depending on
183 content type and/or encoding as follows:
187 .ta \w'\-fixboundary 'u
188 \-decodetext base64 and quoted-printable encoded text parts
189 \-textcodeset text/plain parts
190 \-reformat text parts that are not text/plain
191 \-fixboundary outermost multipart part
192 \-fixcte multipart part
196 .SS "Backup of Original Message/File"
197 If it applies any transformations to a message or file,
202 backs up the original the same way as
206 profile component, if present. If not present,
208 moves the original message to a backup file.
211 switch may be used to override this profile component. The
213 switch disables the use of any
215 profile component and negates all prior
219 .SS "Integration with procmail"
220 By way of example, here is an excerpt from a procmailrc file
221 that filters messages through
223 before storing them in the user's
225 folder. It also stores the incoming message in the
227 folder in a filename generated by
229 which is a non-POSIX utility to generate a temporary file.
230 If you do not have that utility, then the
232 function could form the basis for a substitute. Or,
234 could be called on the message after it is stored.
238 .ta \w'\-fixboundary 'u
239 PATH = %bindir%:$PATH
240 MAILDIR = `mhparam path`
241 MKTEMP = 'mktemp Backups/mhfixmsg.XXXXXXXX'
242 MHFIXMSG = 'mhfixmsg -noverbose -file - -outfile -'
243 STORE = %libdir%/rcvstore
245 :0 w: nmh-worker/procmail.$LOCKEXT
246 * ^TOnmh-workers@nongnu.org
247 | tee `$MKTEMP` | $MHFIXMSG | $STORE +nmh-workers
254 .ta \w'%etcdir%/mhn.defaults 'u
255 ^$HOME/\&.mh\(ruprofile~^The user profile
256 ^%etcdir%/mhn.defaults~^Default mhfixmsg conversion entries
258 .SH "PROFILE COMPONENTS"
262 .ta \w'ExtraBigProfileName 'u
263 ^Path:~^To determine the user's nmh directory
264 ^Current\-Folder:~^To find the default current folder
265 ^rmmproc:~^Program to delete original messages or files
279 .RB ` +folder "' defaults to the current folder"
280 .RB ` msgs "' defaults to cur"
281 .RB ` "\-decodetext 8bit"'
282 .RB ` \-notextcodeset '
284 .RB ` \-fixboundary '
289 If a folder is given, it will become the current folder. The last
290 message selected from a folder will become the current message. If
293 switch is used, the context will not be modified.