4 .TH MHBUILD %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
6 mhbuild \- translate MIME composition draft
12 .RB [ \-verbose " | " \-noverbose ]
19 command will translate a MIME composition draft into
23 creates multi-media messages as specified in RFC\-2045
24 thru RFC\-2049. Currently
26 only supports encodings in
27 message bodies, and does support the encoding of message headers as
28 specified in RFC\-2047.
30 If you specify the name of the composition file as `-',
33 will accept the composition draft on the standard
34 input. If the translation of this input is successful,
36 will output the new MIME message to the standard output. This argument
37 must be the last argument on the command line.
39 Otherwise if the file argument to
41 is the name of a valid
42 composition file, and the translation is successful,
44 will replace the original file with the new MIME message.
45 It will preserve the original file under the same name with `.orig'
47 E.g., if you are editing the file `draft', its original contents
48 it will be preserved as `draft.orig'. This allows you to easily
52 .SS "Translating the Composition File"
54 is essentially a filter to aid in the composition of MIME
60 into a valid MIME message. A
63 is just a file containing plain text that is interspersed
66 directives. When this file is processed
69 the various directives will be expanded to the
70 appropriate content, and will be encoded according to the MIME standards.
71 The resulting MIME message can then be sent by electronic mail.
73 The formal syntax for a
75 composition file is defined at the
76 end of this document, but the ideas behind this format are not complex.
77 Basically, the body contains one or more contents. A content consists of
78 either a directive, indicated with a `#' as the first character
79 of a line; or, plaintext (one or more lines of text). The continuation
80 character, `\\`, may be used to enter a single directive on more
86 /home/foobar/junk/picture.png
90 There are three kinds of directives:
95 .B "(1) The `type' directive
96 is used to directly specify the type and
97 subtype of a content. You may only specify discrete types in this manner
98 (can't specify the types multipart or message with this directive).
99 You may optionally specify the name of a file containing the contents
100 in `native' (decoded) format. If this filename starts with the
101 `|' character, then it represents a command to execute whose
102 output is captured accordingly.
107 #audio/basic |raw2audio \-F < /usr/lib/sound/giggle.au
111 If a filename is not given,
113 will look for information in the
114 user's profile to determine how the different contents should be composed.
115 This is accomplished by consulting a composition string, and executing
118 with the standard output set to the content.
123 will echo any commands that are used to create contents in this way.
125 The composition string may contain the following escapes:
130 %a Insert parameters from directive
131 %f Insert filename containing content
132 %F %f, and stdout is not re-directed
133 %s Insert content subtype
134 %% Insert character %
140 will look for an entry of the form:
143 mhbuild-compose-<type>/<subtype>
146 to determine the command to use to compose the content. If this isn't
149 will look for an entry of the form:
152 mhbuild-compose-<type>
155 to determine the composition command. If this isn't found,
159 An example entry might be:
162 mhbuild-compose-audio/basic: record | raw2audio \-F
165 Because commands like these will vary, depending on the display
166 environment used for login, composition strings for different
167 contents should probably be put in the file specified by the
169 environment variable, instead of directly in your
172 .B "(2) The `message' directive (#forw)
173 is used to specify a message or
174 group of messages to include. You may optionally specify the name of
175 the folder and which messages are to be forwarded. If a folder is not
176 given, it defaults to the current folder. Similarly, if a message is not
177 given, it defaults to the current message. The message directive
185 #forw +inbox 42 43 99
189 If you include a single message, it will be included directly as a content
190 of type `message/rfc822'. If you include more than one message,
193 will add a content of type `multipart/digest'
194 and include each message as a subpart of this content.
196 .B "(3) The `begin' directive
197 is used to create a multipart content.
198 When using the `begin' directive, you must specify at least one
199 content between the begin and end pairs.
204 This will be a multipart with only one part.
209 If you use multiple directives in a composition draft,
212 automatically encapsulate them inside a multipart content. Therefore the
213 `begin' directive is only necessary if you wish to use nested
214 multiparts, or create a multipart message containing only one part.
216 For all of these directives, the user may include a brief description
217 of the content between the `[' character and the `]'
218 character. This description will be copied into the
219 `Content-Description' header when the directive is processed.
223 #forw [important mail from Bob] +bob 1 2 3 4 5
227 Similarly, a disposition string may optionally be provided between
228 `{' and `}' characters; it will be copied into the
229 `Content-Disposition' header when the directive is processed.
230 If a disposition string is provided that does not contain a filename
231 parameter, and a filename is provided in the directive, it will be
232 added to the `Content-Disposition' header. For example, the
237 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
241 creates these message part headers:
245 Content-Type: text/plain; charset="iso-8859-1"
246 Content-Disposition: attachment; filename="summary.txt"
252 will generate a unique `Content-ID:' for each directive,
253 corresponding to each message part; however, the user may override
254 this by defining the ID using the `<' and `>'
257 In addition to the various directives, plaintext can be present.
258 Plaintext is gathered, until a directive is found or the draft is
259 exhausted, and this is made to form a text content. If the plaintext
260 must contain a `#' at the beginning of a line, simply double it,
264 ##when sent, this line will start with only one #
267 If you want to end the plaintext prior to a directive, e.g., to have two
268 plaintext contents adjacent, simply insert a line containing a single
273 this is the first content
275 and this is the second
279 Finally, if the plaintext starts with a line of the form:
282 Content-Description: text
285 then this will be used to describe the plaintext content.
286 You MUST follow this line with a blank line before starting
289 By default, plaintext is captured as a text/plain content. You can
290 override this by starting the plaintext with `#<' followed by
291 a content-type specification. For example, e.g.,
296 this content will be tagged as text/enriched
298 and this content will be tagged as text/plain
300 #<application/x-patch [this is a patch]
301 and this content will be tagged as application/x-patch
305 Note that if you use the `#<' plaintext-form, then the
306 content-description must be on the same line which identifies the content
307 type of the plaintext.
309 When composing a text content, you may indicate the relevant character
310 set by adding the `charset' parameter to the directive.
313 #<text/plain; charset=iso-8859-5
316 If a text content contains any 8\-bit characters (characters with the
317 high bit set) and the character set is not specified as above, then
319 will assume the character set is of the type given by the
320 environment variable MM_CHARSET. If this environment variable is not
321 set, then the character set will be labeled as `x-unknown'.
323 If a text content contains only 7\-bit characters and the character set
324 is not specified as above, then the character set will be labeled as
327 Putting this all together,
328 here is an example of a more complicated message draft. The
329 following draft will expand into a multipart/mixed message
330 containing five parts:
334 To: nobody@nowhere.org
336 Subject: Look and listen to me!
338 The first part will be text/plain
340 The second part will be text/enriched
342 This third part will be text/plain
343 #audio/basic [silly giggle] \\
344 |raw2audio \-F < /usr/lib/sounds/giggle.au
345 #image/gif [photo of foobar] \\
346 /home/foobar/lib/picture.gif
350 .SS "Transfer Encodings"
353 constructs the new MIME message by parsing directives,
354 including files, etc., it scans the contents of the message to determine
355 which transfer encoding to use. It will check for 8bit data, long lines,
356 spaces at the end of lines, and clashes with multipart boundaries. It will
357 then choose a transfer encoding appropriate for each content type.
359 .SS "Invoking mhbuild"
367 composition file, which
369 will create, from the draft file, if MIME features are requested.
370 This is the case with attachment headers.
372 In contrast to previous versions, the user does not need to care
373 for any special actions anymore.
375 .SS "User Environment"
376 Because the environment in which
378 operates may vary for a
381 will look for the environment variable
383 If present, this specifies the name of an additional user profile which
384 should be read. Hence, when a user logs in on a particular machine,
385 this environment variable should be set to refer to a file containing
386 definitions useful for that machine.
390 will attempt to consult a global
395 %etcdir%/mhn.defaults
400 .SS "Syntax of Composition Files"
401 The following is the formal syntax of a
407 body ::= 1*(content | EOL)
409 content ::= directive | plaintext
411 directive ::= "#" type "/" subtype
412 0*(";" attribute "=" value)
415 [ "[" description "]" ]
416 [ "{" disposition "}" ]
422 [ "[" description "]" ]
423 [ "{" disposition "}" ]
424 [ "+"folder ] [ 0*msg ]
429 [ "[" description "]" ]
430 [ "{" disposition "}" ]
438 plaintext ::= [ "Content-Description:"
439 description EOL EOL ]
443 | "#<" type "/" subtype
444 0*(";" attribute "=" value)
446 [ "[" description "]" ]
447 [ "{" disposition "}" ]
452 line ::= "##" text EOL
453 -- interpreted as "#"text EOL
462 .ta \w'%etcdir%/ExtraBigFileName 'u
463 ^$HOME/.mmh/profile~^The user profile
464 ^$MHBUILD~^Additional profile entries
465 ^%etcdir%/mhn.defaults~^System default MIME profile entries
468 .SH "PROFILE COMPONENTS"
472 .ta \w'ExtraBigProfileName 'u
473 ^Path:~^To determine the user's mail storage
474 ^Current\-Folder:~^To find the default current folder
475 ^mhbuild-compose-<type>*~^Template for composing contents
479 mhlist(1), show(1), mhstore(1), forw(1),
481 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
484 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
487 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
490 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
493 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
502 If a folder is given, it will become the current folder. The last
503 message selected will become the current message.
506 Outlook 2002 won't display attachments that have a Content-ID header.
507 This is a bug in Outlook 2002, not in
509 To workaround it, invoke \fIe mhbuild\fP manually at the Whatnow prompt
510 and edit the draft again thereafter, removing the Content-ID headers.
514 switch to prevent Content-ID headers to be inserted, but as it was considered
515 wrong to complicate all other MUAs instead of forcing the developers and users
516 of broken MUAs to fix or change their software, it was removed.