5 .TH MHBUILD %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
7 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 [ \-verbose " | " \-noverbose ]
18 .RB [ \-check " | " \-nocheck ]
24 command will translate a MIME composition draft into
28 creates multi-media messages as specified in RFC\-2045
29 thru RFC\-2049. Currently
31 only supports encodings in
32 message bodies, and does not support the encoding of message headers as
33 specified in RFC\-2047.
35 If you specify the name of the composition file as \*(lq-\*(rq,
38 will accept the composition draft on the standard
39 input. If the translation of this input is successful,
41 will output the new MIME message to the standard output. This argument
42 must be the last argument on the command line.
44 Otherwise if the file argument to
46 is the name of a valid
47 composition file, and the translation is successful,
49 will replace the original file with the new MIME message. It will rename
50 the original file to start with the \*(lq,\*(rq character and end with the
51 string \*(lq.orig\*(rq, e.g., if you are editing the file \*(lqdraft\*(rq,
52 it will be renamed to \*(lq,draft.orig\*(rq. This allows you to easily
56 .SS "Listing the Contents"
61 to list the table of contents associated with the MIME message that is created.
66 that a one-line banner should be displayed above the listing. The
70 to evaluate the \*(lqnative\*(rq
71 (decoded) format of each content prior to listing. This provides an
72 accurate count at the expense of a small delay. If the
75 is present, then the listing will show any \*(lqextra\*(rq information
76 that is present in the message, such as comments in the
77 \*(lqContent-Type\*(rq header.
78 .SS "Translating the Composition File"
80 is essentially a filter to aid in the composition of MIME
85 \*(lqcomposition file\*(rq
86 into a valid MIME message. A
88 \*(lqcomposition file\*(rq
89 is just a file containing plain text that is interspersed
92 directives. When this file is processed
95 the various directives will be expanded to the
96 appropriate content, and will be encoded according to the MIME standards.
97 The resulting MIME message can then be sent by electronic mail.
99 The formal syntax for a
101 composition file is defined at the
102 end of this document, but the ideas behind this format are not complex.
103 Basically, the body contains one or more contents. A content consists of
104 either a directive, indicated with a \*(lq#\*(rq as the first character
105 of a line; or, plaintext (one or more lines of text). The continuation
106 character, \*(lq\\\*(lq, may be used to enter a single directive on more
112 /home/foobar/junk/picture.png
116 There are four kinds of directives: \*(lqtype\*(rq directives, which
117 name the type and subtype of the content; \*(lqexternal-type\*(rq
118 directives, which also name the type and subtype of the content; the
119 \*(lqmessage\*(rq directive (#forw), which is used to forward one or
120 more messages; and, the \*(lqbegin\*(rq directive (#begin), which is
121 used to create a multipart content.
123 The \*(lqtype\*(rq directive 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 The \*(lqexternal-type\*(rq directives are used to provide a MIME
200 reference to a content, rather than enclosing the contents itself
201 (for instance, by specifying an ftp site). Hence, instead of
202 providing a filename as with the type directives, external-parameters
203 are supplied. These look like regular parameters, so they must be
204 separated accordingly. For example,
208 #@application/octet-stream; \\
210 conversions=compress \\
211 [this is the nmh distribution] \\
212 name="nmh.tar.gz"; \\
213 directory="/pub/nmh"; \\
214 site="ftp.math.gatech.edu"; \\
215 access-type=anon-ftp; \\
220 You must give a description string to separate the content parameters
221 from the external-parameters (although this string may be empty).
222 This description string is specified by enclosing it within
225 These parameters are of the form:
229 .ta \w'access-type= 'u
230 access-type= usually \fIanon-ftp\fR or \fImail-server\fR
232 permission= read-only or read-write
234 directory= directoryname (optional)
235 mode= usually \fIascii\fR or \fIimage\fR (optional)
236 size= number of octets
238 subject= subject to send
239 body= command to send for retrieval
243 The \*(lqmessage\*(rq directive (#forw) is used to specify a message or
244 group of messages to include. You may optionally specify the name of
245 the folder and which messages are to be forwarded. If a folder is not
246 given, it defaults to the current folder. Similarly, if a message is not
247 given, it defaults to the current message. Hence, the message directive
250 command, except that the former uses
251 the MIME rules for encapsulation rather than those specified in RFC\-934.
256 #forw +inbox 42 43 99
260 If you include a single message, it will be included directly as a content
261 of type \*(lqmessage/rfc822\*(rq. If you include more than one message,
264 will add a content of type \*(lqmultipart/digest\*(rq
265 and include each message as a subpart of this content.
267 If you are using this directive to include more than one message, you
270 switch. This switch will indicate that
272 should attempt to utilize the MIME encapsulation rules
273 in such a way that the \*(lqmultipart/digest\*(rq that is created
274 is (mostly) compatible with the encapsulation specified in RFC\-934.
275 If given, then RFC\-934 compliant user-agents should be able to burst the
276 message on reception\0--\0providing that the messages being encapsulated
277 do not contain encapsulated messages themselves. The drawback of this
278 approach is that the encapsulations are generated by placing an extra
279 newline at the end of the body of each message.
281 The \*(lqbegin\*(rq directive is used to create a multipart content.
282 When using the \*(lqbegin\*(rq directive, you must specify at least one
283 content between the begin and end pairs.
288 This will be a multipart with only one part.
293 If you use multiple directives in a composition draft,
296 automatically encapsulate them inside a multipart content. Therefore the
297 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
298 multiparts, or create a multipart message containing only one part.
300 For all of these directives, the user may include a brief description
301 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
302 character. This description will be copied into the
303 \*(lqContent-Description\*(rq header when the directive is processed.
307 #forw [important mail from Bob] +bob 1 2 3 4 5
313 will generate a unique \*(lqContent-ID:\*(rq for
314 each directive; however, the user may override this by defining the ID
315 using the \*(lq<\*(rq and \*(lq>\*(rq characters.
317 In addition to the various directives, plaintext can be present.
318 Plaintext is gathered, until a directive is found or the draft is
319 exhausted, and this is made to form a text content. If the plaintext
320 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
324 ##when sent, this line will start with only one #
327 If you want to end the plaintext prior to a directive, e.g., to have two
328 plaintext contents adjacent, simply insert a line containing a single
329 \*(lq#\*(rq character, e.g.,
333 this is the first content
335 and this is the second
339 Finally, if the plaintext starts with a line of the form:
342 Content-Description: text
345 then this will be used to describe the plaintext content.
346 You MUST follow this line with a blank line before starting
349 By default, plaintext is captured as a text/plain content. You can
350 override this by starting the plaintext with \*(lq#<\*(rq followed by
351 a content-type specification. For example, e.g.,
356 this content will be tagged as text/enriched
358 and this content will be tagged as text/plain
360 #<application/x-patch [this is a patch]
361 and this content will be tagged as application/x-patch
365 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
366 content-description must be on the same line which identifies the content
367 type of the plaintext.
369 When composing a text content, you may indicate the relevant character
370 set by adding the \*(lqcharset\*(rq parameter to the directive.
373 #<text/plain; charset=iso-8859-5
376 If a text content contains any 8\-bit characters (characters with the
377 high bit set) and the character set is not specified as above, then
379 will assume the character set is of the type given by the
380 environment variable MM_CHARSET. If this environment variable is not
381 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
383 If a text content contains only 7\-bit characters and the character set
384 is not specified as above, then the character set will be labeled as
387 Putting this all together,
388 here is an example of a more complicated message draft. The
389 following draft will expand into a multipart/mixed message
390 containing five parts:
394 To: nobody@nowhere.org
396 Subject: Look and listen to me!
398 The first part will be text/plain
400 The second part will be text/enriched
402 This third part will be text/plain
403 #audio/basic [silly giggle] \\
404 |raw2audio -F < /usr/lib/sounds/giggle.au
405 #image/gif [photo of foobar] \\
406 /home/foobar/lib/picture.gif
409 .SS "Integrity Check"
414 switch, then it will also associate
415 an integrity check with each \*(lqleaf\*(rq content. This will add a
416 Content-MD5 header field to the content, along with the md5 sum of the
417 unencoded contents. This may be used by the receiver of the message to
418 verify that the contents of the message were not changed in transport.
420 .SS "Transfer Encodings"
423 constructs the new MIME message by parsing directives,
424 including files, etc., it scans the contents of the message to determine
425 which transfer encoding to use. It will check for 8bit data, long lines,
426 spaces at the end of lines, and clashes with multipart boundaries. It will
427 then choose a transfer encoding appropriate for each content type.
429 If an integrity check is being associated with each content by using
434 will encode each content with
435 a transfer encoding, even it the content contains only 7\-bit data. This
436 is to increase the likelihood that the content is not changed while in
444 the way in which it performs the \*(lqquoted-printable\*(rq transfer
445 encoding. Along with encoding 8\-bit characters, it will now also encode
446 certain common punctuation characters as well. This slightly reduces the
447 readability of the message, but allows the message to pass more reliably
448 through mail gateways which involve the EBCDIC character encoding.
450 .SS "Invoking mhbuild"
456 command will expect the body of the draft to be formatted as an
458 composition file. Once you have composed this input file
459 using a command such as
466 at the \*(lqWhat now\*(rq prompt with
472 prior to sending the draft. This will cause
476 to translate the composition file into MIME format.
478 It is also possible to have the
482 automatically when a message is sent. To do this, you must add the line
492 Finally, you should consider adding this line to your profile:
498 This way, if you decide to
508 will work as you expect.
510 .SS "User Environment"
511 Because the environment in which
513 operates may vary for a
516 will look for the environment variable
518 If present, this specifies the name of an additional user profile which
519 should be read. Hence, when a user logs in on a particular machine,
520 this environment variable should be set to refer to a file containing
521 definitions useful for that machine.
525 will attempt to consult a global
530 %etcdir%/mhn.defaults
535 .SS "Syntax of Composition Files"
536 The following is the formal syntax of a
538 \*(lqcomposition file\*(rq.
542 body ::= 1*(content | EOL)
544 content ::= directive | plaintext
546 directive ::= "#" type "/" subtype
547 0*(";" attribute "=" value)
550 [ "[" description "]" ]
554 | "#@" type "/" subtype
555 0*(";" attribute "=" value)
558 [ "[" description "]" ]
564 [ "[" description "]" ]
565 [ "+"folder ] [ 0*msg ]
570 [ "[" description "]" ]
578 plaintext ::= [ "Content-Description:"
579 description EOL EOL ]
583 | "#<" type "/" subtype
584 0*(";" attribute "=" value)
586 [ "[" description "]" ]
591 line ::= "##" text EOL
592 -- interpreted as "#"text EOL
601 .ta \w'/usr/local/nmh/etc/ExtraBigFileName 'u
602 ^$HOME/\&.mh\(ruprofile~^The user profile
603 ^$MHBUILD~^Additional profile entries
604 ^%etcdir%/mhn.defaults~^System default MIME profile entries
607 .SH "PROFILE COMPONENTS"
611 .ta \w'ExtraBigProfileName 'u
612 ^Path:~^To determine the user's nmh directory
613 ^Current\-Folder:~^To find the default current folder
614 ^mhbuild-compose-<type>*~^Template for composing contents
618 mhlist(1), mhshow(1), mhstore(1),
620 .I "Proposed Standard for Message Encapsulation"
623 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
626 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
629 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
632 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
635 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
642 .RB ` \-norfc934mode '
644 .RB ` \-noebcdicsafe '
649 If a folder is given, it will become the current folder. The last
650 message selected will become the current message.