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 four kinds of directives:
119 \*(lqexternal-type\*(rq,
120 \*(lqmessage\*(rq (#forw),
121 and \*(lqbegin\*(rq (#begin).
123 .B "(1) The \*(lqtype\*(rq directive
124 is used to directly specify the type and
125 subtype of a content. You may only specify discrete types in this manner
126 (can't specify the types multipart or message with this directive).
127 You may optionally specify the name of a file containing the contents
128 in \*(lqnative\*(rq (decoded) format. If this filename starts with the
129 \*(lq|\*(rq character, then it represents a command to execute whose
130 output is captured accordingly.
135 #audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
139 If a filename is not given,
141 will look for information in the
142 user's profile to determine how the different contents should be composed.
143 This is accomplished by consulting a composition string, and executing
146 with the standard output set to the content.
151 will echo any commands that are used to create contents in this way.
153 The composition string may contain the following escapes:
158 %a Insert parameters from directive
159 %f Insert filename containing content
160 %F %f, and stdout is not re-directed
161 %s Insert content subtype
162 %% Insert character %
168 will look for an entry of the form:
171 mhbuild-compose-<type>/<subtype>
174 to determine the command to use to compose the content. If this isn't
177 will look for an entry of the form:
180 mhbuild-compose-<type>
183 to determine the composition command. If this isn't found,
187 An example entry might be:
190 mhbuild-compose-audio/basic: record | raw2audio -F
193 Because commands like these will vary, depending on the display
194 environment used for login, composition strings for different
195 contents should probably be put in the file specified by the
197 environment variable, instead of directly in your
200 .B "(2) The \*(lqexternal-type\*(rq directives
201 are used to provide a MIME
202 reference to a content, rather than enclosing the contents itself
203 (for instance, by specifying an ftp site). Hence, instead of
204 providing a filename as with the type directives, external-parameters
205 are supplied. These look like regular parameters, so they must be
206 separated accordingly. For example,
210 #@application/octet-stream; \\
212 conversions=compress \\
213 [this is the nmh distribution] \\
214 {application; filename="nmh.tar.gz"} \\
215 name="nmh.tar.gz"; \\
216 directory="/pub/nmh"; \\
217 site="ftp.math.gatech.edu"; \\
218 access-type=anon-ftp; \\
223 You must give a description string to separate the content parameters
224 from the external-parameters (although this string may be empty).
225 This description string is specified by enclosing it within
226 \*(lq[]\*(rq. A disposition string, to appear in a
227 \*(lqContent-Disposition\*(rq header, may appear in the optional
230 These parameters are of the form:
234 .ta \w'access-type= 'u
235 access-type= usually \fIanon-ftp\fR or \fImail-server\fR
237 permission= read-only or read-write
239 directory= directoryname (optional)
240 mode= usually \fIascii\fR or \fIimage\fR (optional)
241 size= number of octets
243 subject= subject to send
244 body= command to send for retrieval
248 .B "(3) The \*(lqmessage\*(rq directive (#forw)
249 is used to specify a message or
250 group of messages to include. You may optionally specify the name of
251 the folder and which messages are to be forwarded. If a folder is not
252 given, it defaults to the current folder. Similarly, if a message is not
253 given, it defaults to the current message. Hence, the message directive
256 command, except that the former uses
257 the MIME rules for encapsulation rather than those specified in RFC\-934.
262 #forw +inbox 42 43 99
266 If you include a single message, it will be included directly as a content
267 of type \*(lqmessage/rfc822\*(rq. If you include more than one message,
270 will add a content of type \*(lqmultipart/digest\*(rq
271 and include each message as a subpart of this content.
273 If you are using this directive to include more than one message, you
276 switch. This switch will indicate that
278 should attempt to utilize the MIME encapsulation rules
279 in such a way that the \*(lqmultipart/digest\*(rq that is created
280 is (mostly) compatible with the encapsulation specified in RFC\-934.
281 If given, then RFC\-934 compliant user-agents should be able to burst the
282 message on reception\0--\0providing that the messages being encapsulated
283 do not contain encapsulated messages themselves. The drawback of this
284 approach is that the encapsulations are generated by placing an extra
285 newline at the end of the body of each message.
287 .B "(4) The \*(lqbegin\*(rq directive
288 is used to create a multipart content.
289 When using the \*(lqbegin\*(rq directive, you must specify at least one
290 content between the begin and end pairs.
295 This will be a multipart with only one part.
300 If you use multiple directives in a composition draft,
303 automatically encapsulate them inside a multipart content. Therefore the
304 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
305 multiparts, or create a multipart message containing only one part.
307 For all of these directives, the user may include a brief description
308 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
309 character. This description will be copied into the
310 \*(lqContent-Description\*(rq header when the directive is processed.
314 #forw [important mail from Bob] +bob 1 2 3 4 5
318 Similarly, a disposition string may optionally be provided between
319 \*(lq{\*(rq and \*(lq}\*(rq characters; it will be copied into the
320 \*(lqContent-Disposition\*(rq header when the directive is processed.
321 If a disposition string is provided that does not contain a filename
322 parameter, and a filename is provided in the directive, it will be
323 added to the \*(lqContent-Disposition\*(rq header. For example, the
328 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
332 creates these message part headers:
336 Content-Type: text/plain; charset="iso-8859-1"
337 Content-Disposition: attachment; filename="summary.txt"
343 will generate a unique \*(lqContent-ID:\*(rq for each directive,
344 corresponding to each message part; however, the user may override
345 this by defining the ID using the \*(lq<\*(rq and \*(lq>\*(rq
348 switch suppresses creation of all \*(lqContent-ID:\*(rq headers,
349 even in the top level of the message.
351 In addition to the various directives, plaintext can be present.
352 Plaintext is gathered, until a directive is found or the draft is
353 exhausted, and this is made to form a text content. If the plaintext
354 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
358 ##when sent, this line will start with only one #
361 If you want to end the plaintext prior to a directive, e.g., to have two
362 plaintext contents adjacent, simply insert a line containing a single
363 \*(lq#\*(rq character, e.g.,
367 this is the first content
369 and this is the second
373 Finally, if the plaintext starts with a line of the form:
376 Content-Description: text
379 then this will be used to describe the plaintext content.
380 You MUST follow this line with a blank line before starting
383 By default, plaintext is captured as a text/plain content. You can
384 override this by starting the plaintext with \*(lq#<\*(rq followed by
385 a content-type specification. For example, e.g.,
390 this content will be tagged as text/enriched
392 and this content will be tagged as text/plain
394 #<application/x-patch [this is a patch]
395 and this content will be tagged as application/x-patch
399 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
400 content-description must be on the same line which identifies the content
401 type of the plaintext.
403 When composing a text content, you may indicate the relevant character
404 set by adding the \*(lqcharset\*(rq parameter to the directive.
407 #<text/plain; charset=iso-8859-5
410 If a text content contains any 8\-bit characters (characters with the
411 high bit set) and the character set is not specified as above, then
413 will assume the character set is of the type given by the
414 environment variable MM_CHARSET. If this environment variable is not
415 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
417 If a text content contains only 7\-bit characters and the character set
418 is not specified as above, then the character set will be labeled as
421 Putting this all together,
422 here is an example of a more complicated message draft. The
423 following draft will expand into a multipart/mixed message
424 containing five parts:
428 To: nobody@nowhere.org
430 Subject: Look and listen to me!
432 The first part will be text/plain
434 The second part will be text/enriched
436 This third part will be text/plain
437 #audio/basic [silly giggle] \\
438 |raw2audio -F < /usr/lib/sounds/giggle.au
439 #image/gif [photo of foobar] \\
440 /home/foobar/lib/picture.gif
444 .SS "Transfer Encodings"
447 constructs the new MIME message by parsing directives,
448 including files, etc., it scans the contents of the message to determine
449 which transfer encoding to use. It will check for 8bit data, long lines,
450 spaces at the end of lines, and clashes with multipart boundaries. It will
451 then choose a transfer encoding appropriate for each content type.
458 the way in which it performs the \*(lqquoted-printable\*(rq transfer
459 encoding. Along with encoding 8\-bit characters, it will now also encode
460 certain common punctuation characters as well. This slightly reduces the
461 readability of the message, but allows the message to pass more reliably
462 through mail gateways which involve the EBCDIC character encoding.
464 .SS "Invoking mhbuild"
472 composition file, which
474 will create, from the draft file, if MIME features are requested.
475 This is the case with attachment headers.
477 In contrast to previous versions, the user does not need to care
478 for any special actions anymore.
480 .SS "User Environment"
481 Because the environment in which
483 operates may vary for a
486 will look for the environment variable
488 If present, this specifies the name of an additional user profile which
489 should be read. Hence, when a user logs in on a particular machine,
490 this environment variable should be set to refer to a file containing
491 definitions useful for that machine.
495 will attempt to consult a global
500 %etcdir%/mhn.defaults
505 .SS "Syntax of Composition Files"
506 The following is the formal syntax of a
508 \*(lqcomposition file\*(rq.
512 body ::= 1*(content | EOL)
514 content ::= directive | plaintext
516 directive ::= "#" type "/" subtype
517 0*(";" attribute "=" value)
520 [ "[" description "]" ]
521 [ "{" disposition "}" ]
525 | "#@" type "/" subtype
526 0*(";" attribute "=" value)
529 [ "[" description "]" ]
530 [ "{" disposition "}" ]
536 [ "[" description "]" ]
537 [ "{" disposition "}" ]
538 [ "+"folder ] [ 0*msg ]
543 [ "[" description "]" ]
544 [ "{" disposition "}" ]
552 plaintext ::= [ "Content-Description:"
553 description EOL EOL ]
557 | "#<" type "/" subtype
558 0*(";" attribute "=" value)
560 [ "[" description "]" ]
561 [ "{" disposition "}" ]
566 line ::= "##" text EOL
567 -- interpreted as "#"text EOL
576 .ta \w'%etcdir%/ExtraBigFileName 'u
577 ^$HOME/.mmh/profile~^The user profile
578 ^$MHBUILD~^Additional profile entries
579 ^%etcdir%/mhn.defaults~^System default MIME profile entries
582 .SH "PROFILE COMPONENTS"
586 .ta \w'ExtraBigProfileName 'u
587 ^Path:~^To determine the user's mail storage
588 ^Current\-Folder:~^To find the default current folder
589 ^mhbuild-compose-<type>*~^Template for composing contents
593 mhlist(1), mhshow(1), mhstore(1),
595 .I "Proposed Standard for Message Encapsulation"
598 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
601 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
604 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
607 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
610 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
617 .RB ` \-norfc934mode '
619 .RB ` \-noebcdicsafe '
624 If a folder is given, it will become the current folder. The last
625 message selected will become the current message.