4 .TH MHBUILD %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
6 mhbuild \- translate MIME composition draft
12 .RB [ \-list " | " \-nolist ]
13 .RB [ \-realsize " | " \-norealsize ]
14 .RB [ \-headers " | " \-noheaders ]
15 .RB [ \-ebcdicsafe " | " \-noebcdicsafe ]
16 .RB [ \-rfc934mode " | " \-norfc934mode ]
17 .RB [ \-contentid " | " \-nocontentid ]
18 .RB [ \-verbose " | " \-noverbose ]
25 command will translate a MIME composition draft into
29 creates multi-media messages as specified in RFC\-2045
30 thru RFC\-2049. Currently
32 only supports encodings in
33 message bodies, and does not support the encoding of message headers as
34 specified in RFC\-2047.
36 If you specify the name of the composition file as \*(lq-\*(rq,
39 will accept the composition draft on the standard
40 input. If the translation of this input is successful,
42 will output the new MIME message to the standard output. This argument
43 must be the last argument on the command line.
45 Otherwise if the file argument to
47 is the name of a valid
48 composition file, and the translation is successful,
50 will replace the original file with the new MIME message. It will rename
51 the original file to start with the \*(lq,\*(rq character and end with the
52 string \*(lq.orig\*(rq, e.g., if you are editing the file \*(lqdraft\*(rq,
53 it will be renamed to \*(lq,draft.orig\*(rq. This allows you to easily
57 .SS "Listing the Contents"
62 to list the table of contents associated with the MIME message that is created.
67 that a one-line banner should be displayed above the listing. The
71 to evaluate the \*(lqnative\*(rq
72 (decoded) format of each content prior to listing. This provides an
73 accurate count at the expense of a small delay. If the
76 is present, then the listing will show any \*(lqextra\*(rq information
77 that is present in the message, such as comments in the
78 \*(lqContent-Type\*(rq header.
79 .SS "Translating the Composition File"
81 is essentially a filter to aid in the composition of MIME
86 \*(lqcomposition file\*(rq
87 into a valid MIME message. A
89 \*(lqcomposition file\*(rq
90 is just a file containing plain text that is interspersed
93 directives. When this file is processed
96 the various directives will be expanded to the
97 appropriate content, and will be encoded according to the MIME standards.
98 The resulting MIME message can then be sent by electronic mail.
100 The formal syntax for a
102 composition file is defined at the
103 end of this document, but the ideas behind this format are not complex.
104 Basically, the body contains one or more contents. A content consists of
105 either a directive, indicated with a \*(lq#\*(rq as the first character
106 of a line; or, plaintext (one or more lines of text). The continuation
107 character, \*(lq\\\*(lq, may be used to enter a single directive on more
113 /home/foobar/junk/picture.png
117 There are three kinds of directives:
119 \*(lqmessage\*(rq (#forw),
120 and \*(lqbegin\*(rq (#begin).
122 .B "(1) The \*(lqtype\*(rq directive
123 is used to directly specify the type and
124 subtype of a content. You may only specify discrete types in this manner
125 (can't specify the types multipart or message with this directive).
126 You may optionally specify the name of a file containing the contents
127 in \*(lqnative\*(rq (decoded) format. If this filename starts with the
128 \*(lq|\*(rq character, then it represents a command to execute whose
129 output is captured accordingly.
134 #audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
138 If a filename is not given,
140 will look for information in the
141 user's profile to determine how the different contents should be composed.
142 This is accomplished by consulting a composition string, and executing
145 with the standard output set to the content.
150 will echo any commands that are used to create contents in this way.
152 The composition string may contain the following escapes:
157 %a Insert parameters from directive
158 %f Insert filename containing content
159 %F %f, and stdout is not re-directed
160 %s Insert content subtype
161 %% Insert character %
167 will look for an entry of the form:
170 mhbuild-compose-<type>/<subtype>
173 to determine the command to use to compose the content. If this isn't
176 will look for an entry of the form:
179 mhbuild-compose-<type>
182 to determine the composition command. If this isn't found,
186 An example entry might be:
189 mhbuild-compose-audio/basic: record | raw2audio -F
192 Because commands like these will vary, depending on the display
193 environment used for login, composition strings for different
194 contents should probably be put in the file specified by the
196 environment variable, instead of directly in your
199 .B "(2) The \*(lqmessage\*(rq directive (#forw)
200 is used to specify a message or
201 group of messages to include. You may optionally specify the name of
202 the folder and which messages are to be forwarded. If a folder is not
203 given, it defaults to the current folder. Similarly, if a message is not
204 given, it defaults to the current message. Hence, the message directive
207 command, except that the former uses
208 the MIME rules for encapsulation rather than those specified in RFC\-934.
213 #forw +inbox 42 43 99
217 If you include a single message, it will be included directly as a content
218 of type \*(lqmessage/rfc822\*(rq. If you include more than one message,
221 will add a content of type \*(lqmultipart/digest\*(rq
222 and include each message as a subpart of this content.
224 If you are using this directive to include more than one message, you
227 switch. This switch will indicate that
229 should attempt to utilize the MIME encapsulation rules
230 in such a way that the \*(lqmultipart/digest\*(rq that is created
231 is (mostly) compatible with the encapsulation specified in RFC\-934.
232 If given, then RFC\-934 compliant user-agents should be able to burst the
233 message on reception\0--\0providing that the messages being encapsulated
234 do not contain encapsulated messages themselves. The drawback of this
235 approach is that the encapsulations are generated by placing an extra
236 newline at the end of the body of each message.
238 .B "(3) The \*(lqbegin\*(rq directive
239 is used to create a multipart content.
240 When using the \*(lqbegin\*(rq directive, you must specify at least one
241 content between the begin and end pairs.
246 This will be a multipart with only one part.
251 If you use multiple directives in a composition draft,
254 automatically encapsulate them inside a multipart content. Therefore the
255 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
256 multiparts, or create a multipart message containing only one part.
258 For all of these directives, the user may include a brief description
259 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
260 character. This description will be copied into the
261 \*(lqContent-Description\*(rq header when the directive is processed.
265 #forw [important mail from Bob] +bob 1 2 3 4 5
269 Similarly, a disposition string may optionally be provided between
270 \*(lq{\*(rq and \*(lq}\*(rq characters; it will be copied into the
271 \*(lqContent-Disposition\*(rq header when the directive is processed.
272 If a disposition string is provided that does not contain a filename
273 parameter, and a filename is provided in the directive, it will be
274 added to the \*(lqContent-Disposition\*(rq header. For example, the
279 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
283 creates these message part headers:
287 Content-Type: text/plain; charset="iso-8859-1"
288 Content-Disposition: attachment; filename="summary.txt"
294 will generate a unique \*(lqContent-ID:\*(rq for each directive,
295 corresponding to each message part; however, the user may override
296 this by defining the ID using the \*(lq<\*(rq and \*(lq>\*(rq
299 switch suppresses creation of all \*(lqContent-ID:\*(rq headers,
300 even in the top level of the message.
302 In addition to the various directives, plaintext can be present.
303 Plaintext is gathered, until a directive is found or the draft is
304 exhausted, and this is made to form a text content. If the plaintext
305 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
309 ##when sent, this line will start with only one #
312 If you want to end the plaintext prior to a directive, e.g., to have two
313 plaintext contents adjacent, simply insert a line containing a single
314 \*(lq#\*(rq character, e.g.,
318 this is the first content
320 and this is the second
324 Finally, if the plaintext starts with a line of the form:
327 Content-Description: text
330 then this will be used to describe the plaintext content.
331 You MUST follow this line with a blank line before starting
334 By default, plaintext is captured as a text/plain content. You can
335 override this by starting the plaintext with \*(lq#<\*(rq followed by
336 a content-type specification. For example, e.g.,
341 this content will be tagged as text/enriched
343 and this content will be tagged as text/plain
345 #<application/x-patch [this is a patch]
346 and this content will be tagged as application/x-patch
350 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
351 content-description must be on the same line which identifies the content
352 type of the plaintext.
354 When composing a text content, you may indicate the relevant character
355 set by adding the \*(lqcharset\*(rq parameter to the directive.
358 #<text/plain; charset=iso-8859-5
361 If a text content contains any 8\-bit characters (characters with the
362 high bit set) and the character set is not specified as above, then
364 will assume the character set is of the type given by the
365 environment variable MM_CHARSET. If this environment variable is not
366 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
368 If a text content contains only 7\-bit characters and the character set
369 is not specified as above, then the character set will be labeled as
372 Putting this all together,
373 here is an example of a more complicated message draft. The
374 following draft will expand into a multipart/mixed message
375 containing five parts:
379 To: nobody@nowhere.org
381 Subject: Look and listen to me!
383 The first part will be text/plain
385 The second part will be text/enriched
387 This third part will be text/plain
388 #audio/basic [silly giggle] \\
389 |raw2audio -F < /usr/lib/sounds/giggle.au
390 #image/gif [photo of foobar] \\
391 /home/foobar/lib/picture.gif
395 .SS "Transfer Encodings"
398 constructs the new MIME message by parsing directives,
399 including files, etc., it scans the contents of the message to determine
400 which transfer encoding to use. It will check for 8bit data, long lines,
401 spaces at the end of lines, and clashes with multipart boundaries. It will
402 then choose a transfer encoding appropriate for each content type.
409 the way in which it performs the \*(lqquoted-printable\*(rq transfer
410 encoding. Along with encoding 8\-bit characters, it will now also encode
411 certain common punctuation characters as well. This slightly reduces the
412 readability of the message, but allows the message to pass more reliably
413 through mail gateways which involve the EBCDIC character encoding.
415 .SS "Invoking mhbuild"
423 composition file, which
425 will create, from the draft file, if MIME features are requested.
426 This is the case with attachment headers.
428 In contrast to previous versions, the user does not need to care
429 for any special actions anymore.
431 .SS "User Environment"
432 Because the environment in which
434 operates may vary for a
437 will look for the environment variable
439 If present, this specifies the name of an additional user profile which
440 should be read. Hence, when a user logs in on a particular machine,
441 this environment variable should be set to refer to a file containing
442 definitions useful for that machine.
446 will attempt to consult a global
451 %etcdir%/mhn.defaults
456 .SS "Syntax of Composition Files"
457 The following is the formal syntax of a
459 \*(lqcomposition file\*(rq.
463 body ::= 1*(content | EOL)
465 content ::= directive | plaintext
467 directive ::= "#" type "/" subtype
468 0*(";" attribute "=" value)
471 [ "[" description "]" ]
472 [ "{" disposition "}" ]
478 [ "[" description "]" ]
479 [ "{" disposition "}" ]
480 [ "+"folder ] [ 0*msg ]
485 [ "[" description "]" ]
486 [ "{" disposition "}" ]
494 plaintext ::= [ "Content-Description:"
495 description EOL EOL ]
499 | "#<" type "/" subtype
500 0*(";" attribute "=" value)
502 [ "[" description "]" ]
503 [ "{" disposition "}" ]
508 line ::= "##" text EOL
509 -- interpreted as "#"text EOL
518 .ta \w'%etcdir%/ExtraBigFileName 'u
519 ^$HOME/.mmh/profile~^The user profile
520 ^$MHBUILD~^Additional profile entries
521 ^%etcdir%/mhn.defaults~^System default MIME profile entries
524 .SH "PROFILE COMPONENTS"
528 .ta \w'ExtraBigProfileName 'u
529 ^Path:~^To determine the user's mail storage
530 ^Current\-Folder:~^To find the default current folder
531 ^mhbuild-compose-<type>*~^Template for composing contents
535 mhlist(1), show(1), mhstore(1),
537 .I "Proposed Standard for Message Encapsulation"
540 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
543 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
546 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
549 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
552 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
559 .RB ` \-norfc934mode '
561 .RB ` \-noebcdicsafe '
566 If a folder is given, it will become the current folder. The last
567 message selected will become the current message.