4 .TH MHBUILD %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
6 mhbuild \- translate MIME composition draft
12 .RB [ \-list " | " \-nolist ]
13 .RB [ \-headers " | " \-noheaders ]
14 .RB [ \-rfc934mode " | " \-norfc934mode ]
15 .RB [ \-contentid " | " \-nocontentid ]
16 .RB [ \-verbose " | " \-noverbose ]
23 command will translate a MIME composition draft into
27 creates multi-media messages as specified in RFC\-2045
28 thru RFC\-2049. Currently
30 only supports encodings in
31 message bodies, and does not support the encoding of message headers as
32 specified in RFC\-2047.
34 If you specify the name of the composition file as \*(lq-\*(rq,
37 will accept the composition draft on the standard
38 input. If the translation of this input is successful,
40 will output the new MIME message to the standard output. This argument
41 must be the last argument on the command line.
43 Otherwise if the file argument to
45 is the name of a valid
46 composition file, and the translation is successful,
48 will replace the original file with the new MIME message. It will rename
49 the original file to start with the \*(lq,\*(rq character and end with the
50 string \*(lq.orig\*(rq, e.g., if you are editing the file \*(lqdraft\*(rq,
51 it will be renamed to \*(lq,draft.orig\*(rq. This allows you to easily
55 .SS "Listing the Contents"
60 to list the table of contents associated with the MIME message that is created.
65 that a one-line banner should be displayed above the listing.
66 The size of the \*(lqnative\*(rq
67 (decoded) format of each content is evaluated. This provides an
68 accurate count at the expense of a small delay.
72 is present, then the listing will show any \*(lqextra\*(rq information
73 that is present in the message, such as comments in the
74 \*(lqContent-Type\*(rq header.
75 .SS "Translating the Composition File"
77 is essentially a filter to aid in the composition of MIME
82 \*(lqcomposition file\*(rq
83 into a valid MIME message. A
85 \*(lqcomposition file\*(rq
86 is just a file containing plain text that is interspersed
89 directives. When this file is processed
92 the various directives will be expanded to the
93 appropriate content, and will be encoded according to the MIME standards.
94 The resulting MIME message can then be sent by electronic mail.
96 The formal syntax for a
98 composition file is defined at the
99 end of this document, but the ideas behind this format are not complex.
100 Basically, the body contains one or more contents. A content consists of
101 either a directive, indicated with a \*(lq#\*(rq as the first character
102 of a line; or, plaintext (one or more lines of text). The continuation
103 character, \*(lq\\\*(lq, may be used to enter a single directive on more
109 /home/foobar/junk/picture.png
113 There are three kinds of directives:
115 \*(lqmessage\*(rq (#forw),
116 and \*(lqbegin\*(rq (#begin).
118 .B "(1) The \*(lqtype\*(rq directive
119 is used to directly specify the type and
120 subtype of a content. You may only specify discrete types in this manner
121 (can't specify the types multipart or message with this directive).
122 You may optionally specify the name of a file containing the contents
123 in \*(lqnative\*(rq (decoded) format. If this filename starts with the
124 \*(lq|\*(rq character, then it represents a command to execute whose
125 output is captured accordingly.
130 #audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
134 If a filename is not given,
136 will look for information in the
137 user's profile to determine how the different contents should be composed.
138 This is accomplished by consulting a composition string, and executing
141 with the standard output set to the content.
146 will echo any commands that are used to create contents in this way.
148 The composition string may contain the following escapes:
153 %a Insert parameters from directive
154 %f Insert filename containing content
155 %F %f, and stdout is not re-directed
156 %s Insert content subtype
157 %% Insert character %
163 will look for an entry of the form:
166 mhbuild-compose-<type>/<subtype>
169 to determine the command to use to compose the content. If this isn't
172 will look for an entry of the form:
175 mhbuild-compose-<type>
178 to determine the composition command. If this isn't found,
182 An example entry might be:
185 mhbuild-compose-audio/basic: record | raw2audio -F
188 Because commands like these will vary, depending on the display
189 environment used for login, composition strings for different
190 contents should probably be put in the file specified by the
192 environment variable, instead of directly in your
195 .B "(2) The \*(lqmessage\*(rq directive (#forw)
196 is used to specify a message or
197 group of messages to include. You may optionally specify the name of
198 the folder and which messages are to be forwarded. If a folder is not
199 given, it defaults to the current folder. Similarly, if a message is not
200 given, it defaults to the current message. Hence, the message directive
203 command, except that the former uses
204 the MIME rules for encapsulation rather than those specified in RFC\-934.
209 #forw +inbox 42 43 99
213 If you include a single message, it will be included directly as a content
214 of type \*(lqmessage/rfc822\*(rq. If you include more than one message,
217 will add a content of type \*(lqmultipart/digest\*(rq
218 and include each message as a subpart of this content.
220 If you are using this directive to include more than one message, you
223 switch. This switch will indicate that
225 should attempt to utilize the MIME encapsulation rules
226 in such a way that the \*(lqmultipart/digest\*(rq that is created
227 is (mostly) compatible with the encapsulation specified in RFC\-934.
228 If given, then RFC\-934 compliant user-agents should be able to burst the
229 message on reception\0--\0providing that the messages being encapsulated
230 do not contain encapsulated messages themselves. The drawback of this
231 approach is that the encapsulations are generated by placing an extra
232 newline at the end of the body of each message.
234 .B "(3) The \*(lqbegin\*(rq directive
235 is used to create a multipart content.
236 When using the \*(lqbegin\*(rq directive, you must specify at least one
237 content between the begin and end pairs.
242 This will be a multipart with only one part.
247 If you use multiple directives in a composition draft,
250 automatically encapsulate them inside a multipart content. Therefore the
251 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
252 multiparts, or create a multipart message containing only one part.
254 For all of these directives, the user may include a brief description
255 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
256 character. This description will be copied into the
257 \*(lqContent-Description\*(rq header when the directive is processed.
261 #forw [important mail from Bob] +bob 1 2 3 4 5
265 Similarly, a disposition string may optionally be provided between
266 \*(lq{\*(rq and \*(lq}\*(rq characters; it will be copied into the
267 \*(lqContent-Disposition\*(rq header when the directive is processed.
268 If a disposition string is provided that does not contain a filename
269 parameter, and a filename is provided in the directive, it will be
270 added to the \*(lqContent-Disposition\*(rq header. For example, the
275 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
279 creates these message part headers:
283 Content-Type: text/plain; charset="iso-8859-1"
284 Content-Disposition: attachment; filename="summary.txt"
290 will generate a unique \*(lqContent-ID:\*(rq for each directive,
291 corresponding to each message part; however, the user may override
292 this by defining the ID using the \*(lq<\*(rq and \*(lq>\*(rq
295 switch suppresses creation of all \*(lqContent-ID:\*(rq headers,
296 even in the top level of the message.
298 In addition to the various directives, plaintext can be present.
299 Plaintext is gathered, until a directive is found or the draft is
300 exhausted, and this is made to form a text content. If the plaintext
301 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
305 ##when sent, this line will start with only one #
308 If you want to end the plaintext prior to a directive, e.g., to have two
309 plaintext contents adjacent, simply insert a line containing a single
310 \*(lq#\*(rq character, e.g.,
314 this is the first content
316 and this is the second
320 Finally, if the plaintext starts with a line of the form:
323 Content-Description: text
326 then this will be used to describe the plaintext content.
327 You MUST follow this line with a blank line before starting
330 By default, plaintext is captured as a text/plain content. You can
331 override this by starting the plaintext with \*(lq#<\*(rq followed by
332 a content-type specification. For example, e.g.,
337 this content will be tagged as text/enriched
339 and this content will be tagged as text/plain
341 #<application/x-patch [this is a patch]
342 and this content will be tagged as application/x-patch
346 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
347 content-description must be on the same line which identifies the content
348 type of the plaintext.
350 When composing a text content, you may indicate the relevant character
351 set by adding the \*(lqcharset\*(rq parameter to the directive.
354 #<text/plain; charset=iso-8859-5
357 If a text content contains any 8\-bit characters (characters with the
358 high bit set) and the character set is not specified as above, then
360 will assume the character set is of the type given by the
361 environment variable MM_CHARSET. If this environment variable is not
362 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
364 If a text content contains only 7\-bit characters and the character set
365 is not specified as above, then the character set will be labeled as
368 Putting this all together,
369 here is an example of a more complicated message draft. The
370 following draft will expand into a multipart/mixed message
371 containing five parts:
375 To: nobody@nowhere.org
377 Subject: Look and listen to me!
379 The first part will be text/plain
381 The second part will be text/enriched
383 This third part will be text/plain
384 #audio/basic [silly giggle] \\
385 |raw2audio -F < /usr/lib/sounds/giggle.au
386 #image/gif [photo of foobar] \\
387 /home/foobar/lib/picture.gif
391 .SS "Transfer Encodings"
394 constructs the new MIME message by parsing directives,
395 including files, etc., it scans the contents of the message to determine
396 which transfer encoding to use. It will check for 8bit data, long lines,
397 spaces at the end of lines, and clashes with multipart boundaries. It will
398 then choose a transfer encoding appropriate for each content type.
400 .SS "Invoking mhbuild"
408 composition file, which
410 will create, from the draft file, if MIME features are requested.
411 This is the case with attachment headers.
413 In contrast to previous versions, the user does not need to care
414 for any special actions anymore.
416 .SS "User Environment"
417 Because the environment in which
419 operates may vary for a
422 will look for the environment variable
424 If present, this specifies the name of an additional user profile which
425 should be read. Hence, when a user logs in on a particular machine,
426 this environment variable should be set to refer to a file containing
427 definitions useful for that machine.
431 will attempt to consult a global
436 %etcdir%/mhn.defaults
441 .SS "Syntax of Composition Files"
442 The following is the formal syntax of a
444 \*(lqcomposition file\*(rq.
448 body ::= 1*(content | EOL)
450 content ::= directive | plaintext
452 directive ::= "#" type "/" subtype
453 0*(";" attribute "=" value)
456 [ "[" description "]" ]
457 [ "{" disposition "}" ]
463 [ "[" description "]" ]
464 [ "{" disposition "}" ]
465 [ "+"folder ] [ 0*msg ]
470 [ "[" description "]" ]
471 [ "{" disposition "}" ]
479 plaintext ::= [ "Content-Description:"
480 description EOL EOL ]
484 | "#<" type "/" subtype
485 0*(";" attribute "=" value)
487 [ "[" description "]" ]
488 [ "{" disposition "}" ]
493 line ::= "##" text EOL
494 -- interpreted as "#"text EOL
503 .ta \w'%etcdir%/ExtraBigFileName 'u
504 ^$HOME/.mmh/profile~^The user profile
505 ^$MHBUILD~^Additional profile entries
506 ^%etcdir%/mhn.defaults~^System default MIME profile entries
509 .SH "PROFILE COMPONENTS"
513 .ta \w'ExtraBigProfileName 'u
514 ^Path:~^To determine the user's mail storage
515 ^Current\-Folder:~^To find the default current folder
516 ^mhbuild-compose-<type>*~^Template for composing contents
520 mhlist(1), show(1), mhstore(1),
522 .I "Proposed Standard for Message Encapsulation"
525 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
528 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
531 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
534 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
537 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
543 .RB ` \-norfc934mode '
549 If a folder is given, it will become the current folder. The last
550 message selected will become the current message.