mhbuild: Don't list anything (removed -list and -header).
[mmh] / man / mhbuild.man1
1 .\"
2 .\" %nmhwarning%
3 .\"
4 .TH MHBUILD %manext1% "%nmhdate%" MH.6.8 [%nmhversion%]
5 .SH NAME
6 mhbuild \- translate MIME composition draft
7 .SH SYNOPSIS
8 .na
9 .HP 5
10 .B mhbuild
11 .I file
12 .RB [ \-contentid " | " \-nocontentid ]
13 .RB [ \-verbose " | " \-noverbose ]
14 .RB [ \-version ]
15 .RB [ \-help ]
16 .ad
17 .SH DESCRIPTION
18 The
19 .B mhbuild
20 command will translate a MIME composition draft into
21 a valid MIME message.
22 .PP
23 .B mhbuild
24 creates multi-media messages as specified in RFC\-2045
25 thru RFC\-2049.  Currently
26 .B mhbuild
27 only supports encodings in
28 message bodies, and does not support the encoding of message headers as
29 specified in RFC\-2047.
30 .PP
31 If you specify the name of the composition file as \*(lq-\*(rq,
32 then
33 .B mhbuild
34 will accept the composition draft on the standard
35 input.  If the translation of this input is successful,
36 .B mhbuild
37 will output the new MIME message to the standard output.  This argument
38 must be the last argument on the command line.
39 .PP
40 Otherwise if the file argument to
41 .B mhbuild
42 is the name of a valid
43 composition file, and the translation is successful,
44 .B mhbuild
45 will replace the original file with the new MIME message.  It will rename
46 the original file to start with the \*(lq,\*(rq character and end with the
47 string \*(lq.orig\*(rq, e.g., if you are editing the file \*(lqdraft\*(rq,
48 it will be renamed to \*(lq,draft.orig\*(rq.  This allows you to easily
49 recover the
50 .B mhbuild
51 input file.
52 .SS "Translating the Composition File"
53 .B mhbuild
54 is essentially a filter to aid in the composition of MIME
55 messages.
56 .B mhbuild
57 will convert an
58 .B mhbuild
59 \*(lqcomposition file\*(rq
60 into a valid MIME message.  A
61 .B mhbuild
62 \*(lqcomposition file\*(rq
63 is just a file containing plain text that is interspersed
64 with various
65 .B mhbuild
66 directives.  When this file is processed
67 by
68 .BR mhbuild ,
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.
72 .PP
73 The formal syntax for a
74 .B mhbuild
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 \*(lq#\*(rq as the first character
79 of a line; or, plaintext (one or more lines of text).  The continuation
80 character, \*(lq\\\*(lq, may be used to enter a single directive on more
81 than one line, e.g.,
82 .PP
83 .RS 5
84 .nf
85 #image/png \\
86     /home/foobar/junk/picture.png
87 .fi
88 .RE
89 .PP
90 There are three kinds of directives:
91 \*(lqtype\*(rq,
92 \*(lqmessage\*(rq (#forw),
93 and \*(lqbegin\*(rq (#begin).
94 .PP
95 .B "(1) The \*(lqtype\*(rq 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 \*(lqnative\*(rq (decoded) format.  If this filename starts with the
101 \*(lq|\*(rq character, then it represents a command to execute whose
102 output is captured accordingly.
103 For example,
104 .PP
105 .RS 5
106 .nf
107 #audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
108 .fi
109 .RE
110 .PP
111 If a filename is not given,
112 .B mhbuild
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
116 it under
117 .BR /bin/sh ,
118 with the standard output set to the content.
119 If the
120 .B \-verbose
121 switch is given,
122 .B mhbuild
123 will echo any commands that are used to create contents in this way.
124 .PP
125 The composition string may contain the following escapes:
126 .PP
127 .RS 5
128 .nf
129 .ta \w'%P  'u
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 %
135 .fi
136 .RE
137 .PP
138 First,
139 .B mhbuild
140 will look for an entry of the form:
141 .PP
142 .RS 5
143 mhbuild-compose-<type>/<subtype>
144 .RE
145 .PP
146 to determine the command to use to compose the content.  If this isn't
147 found,
148 .B mhbuild
149 will look for an entry of the form:
150 .PP
151 .RS 5
152 mhbuild-compose-<type>
153 .RE
154 .PP
155 to determine the composition command. If this isn't found,
156 .B mhbuild
157 will complain.
158 .PP
159 An example entry might be:
160 .PP
161 .RS 5
162 mhbuild-compose-audio/basic: record | raw2audio -F
163 .RE
164 .PP
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
168 .B $MHBUILD
169 environment variable, instead of directly in your
170 user profile.
171 .PP
172 .B "(2) The \*(lqmessage\*(rq 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
178 is used by
179 .BR forw .
180 .PP
181 For example,
182 .PP
183 .RS 5
184 .nf
185 #forw +inbox 42 43 99
186 .fi
187 .RE
188 .PP
189 If you include a single message, it will be included directly as a content
190 of type \*(lqmessage/rfc822\*(rq.  If you include more than one message,
191 then
192 .B mhbuild
193 will add a content of type \*(lqmultipart/digest\*(rq
194 and include each message as a subpart of this content.
195 .PP
196 .B "(3) The \*(lqbegin\*(rq directive
197 is used to create a multipart content.
198 When using the \*(lqbegin\*(rq directive, you must specify at least one
199 content between the begin and end pairs.
200 .PP
201 .RS 5
202 .nf
203 #begin
204 This will be a multipart with only one part.
205 #end
206 .fi
207 .RE
208 .PP
209 If you use multiple directives in a composition draft,
210 .B mhbuild
211 will
212 automatically encapsulate them inside a multipart content.  Therefore the
213 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
214 multiparts, or create a multipart message containing only one part.
215 .PP
216 For all of these directives, the user may include a brief description
217 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
218 character.  This description will be copied into the
219 \*(lqContent-Description\*(rq header when the directive is processed.
220 .PP
221 .RS 5
222 .nf
223 #forw [important mail from Bob] +bob 1 2 3 4 5
224 .fi
225 .RE
226 .PP
227 Similarly, a disposition string may optionally be provided between
228 \*(lq{\*(rq and \*(lq}\*(rq characters; it will be copied into the
229 \*(lqContent-Disposition\*(rq 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 \*(lqContent-Disposition\*(rq header.  For example, the
233 following directive:
234 .PP
235 .RS 5
236 .nf
237 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
238 .fi
239 .RE
240 .PP
241 creates these message part headers:
242 .PP
243 .RS 5
244 .nf
245 Content-Type: text/plain; charset="iso-8859-1"
246 Content-Disposition: attachment; filename="summary.txt"
247 .fi
248 .RE
249 .PP
250 By default,
251 .B mhbuild
252 will generate a unique \*(lqContent-ID:\*(rq for each directive,
253 corresponding to each message part; however, the user may override
254 this by defining the ID using the \*(lq<\*(rq and \*(lq>\*(rq
255 characters.  The
256 .B \-nocontentid
257 switch suppresses creation of all \*(lqContent-ID:\*(rq headers,
258 even in the top level of the message.
259 .PP
260 In addition to the various directives, plaintext can be present.
261 Plaintext is gathered, until a directive is found or the draft is
262 exhausted, and this is made to form a text content.  If the plaintext
263 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
264 e.g.,
265 .PP
266 .RS 5
267 ##when sent, this line will start with only one #
268 .RE
269 .PP
270 If you want to end the plaintext prior to a directive, e.g., to have two
271 plaintext contents adjacent, simply insert a line containing a single
272 \*(lq#\*(rq character, e.g.,
273 .PP
274 .RS 5
275 .nf
276 this is the first content
277 #
278 and this is the second
279 .fi
280 .RE
281 .PP
282 Finally, if the plaintext starts with a line of the form:
283 .PP
284 .RS 5
285 Content-Description: text
286 .RE
287 .PP
288 then this will be used to describe the plaintext content.
289 You MUST follow this line with a blank line before starting
290 your text.
291 .PP
292 By default, plaintext is captured as a text/plain content.  You can
293 override this by starting the plaintext with \*(lq#<\*(rq followed by
294 a content-type specification.  For example, e.g.,
295 .PP
296 .RS 5
297 .nf
298 #<text/enriched
299 this content will be tagged as text/enriched
300 #
301 and this content will be tagged as text/plain
302 #
303 #<application/x-patch [this is a patch]
304 and this content will be tagged as application/x-patch
305 .fi
306 .RE
307 .PP
308 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
309 content-description must be on the same line which identifies the content
310 type of the plaintext.
311 .PP
312 When composing a text content, you may indicate the relevant character
313 set by adding the \*(lqcharset\*(rq parameter to the directive.
314 .PP
315 .RS 5
316 #<text/plain; charset=iso-8859-5
317 .RE
318 .PP
319 If a text content contains any 8\-bit characters (characters with the
320 high bit set) and the character set is not specified as above, then
321 .B mhbuild
322 will assume the character set is of the type given by the
323 environment variable MM_CHARSET.  If this environment variable is not
324 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
325 .PP
326 If a text content contains only 7\-bit characters and the character set
327 is not specified as above, then the character set will be labeled as
328 \*(lqus-ascii\*(rq.
329 .PP
330 Putting this all together,
331 here is an example of a more complicated message draft.  The
332 following draft will expand into a multipart/mixed message
333 containing five parts:
334 .PP
335 .RS 5
336 .nf
337 To: nobody@nowhere.org
338 Cc:
339 Subject: Look and listen to me!
340 --------
341 The first part will be text/plain
342 #<text/enriched
343 The second part will be text/enriched
344 #
345 This third part will be text/plain
346 #audio/basic [silly giggle]  \\
347     |raw2audio -F < /usr/lib/sounds/giggle.au
348 #image/gif   [photo of foobar] \\
349                     /home/foobar/lib/picture.gif
350 .fi
351 .RE
352
353 .SS "Transfer Encodings"
354 After
355 .B mhbuild
356 constructs the new MIME message by parsing directives,
357 including files, etc., it scans the contents of the message to determine
358 which transfer encoding to use.  It will check for 8bit data, long lines,
359 spaces at the end of lines, and clashes with multipart boundaries.  It will
360 then choose a transfer encoding appropriate for each content type.
361
362 .SS "Invoking mhbuild"
363 Typically,
364 .B mhbuild
365 is invoked by the
366 .B send
367 program.
368 It expects an
369 .B mhbuild
370 composition file, which
371 .B send
372 will create, from the draft file, if MIME features are requested.
373 This is the case with attachment headers.
374 .PP
375 In contrast to previous versions, the user does not need to care
376 for any special actions anymore.
377
378 .SS "User Environment"
379 Because the environment in which
380 .B mhbuild
381 operates may vary for a
382 user,
383 .B mhbuild
384 will look for the environment variable
385 .BR $MHBUILD .
386 If present, this specifies the name of an additional user profile which
387 should be read.  Hence, when a user logs in on a particular machine,
388 this environment variable should be set to refer to a file containing
389 definitions useful for that machine.
390 .PP
391 Finally,
392 .B mhbuild
393 will attempt to consult a global
394 .B mhbuild
395 user profile, e.g.,
396 .PP
397 .RS 5
398 %etcdir%/mhn.defaults
399 .RE
400 .PP
401 if it exists.
402
403 .SS "Syntax of Composition Files"
404 The following is the formal syntax of a
405 .B mhbuild
406 \*(lqcomposition file\*(rq.
407 .PP
408 .RS 5
409 .nf
410 body         ::=     1*(content | EOL)
411
412 content      ::=     directive | plaintext
413
414 directive    ::=     "#" type "/" subtype
415                          0*(";" attribute "=" value)
416                          [ "(" comment ")" ]
417                          [ "<" id ">" ]
418                          [ "[" description "]" ]
419                          [ "{" disposition "}" ]
420                          [ filename ]
421                          EOL
422
423                    | "#forw"
424                          [ "<" id ">" ]
425                          [ "[" description "]" ]
426                          [ "{" disposition "}" ]
427                          [ "+"folder ] [ 0*msg ]
428                          EOL
429
430                    | "#begin"
431                            [ "<" id ">" ]
432                            [ "[" description "]" ]
433                            [ "{" disposition "}" ]
434                            [   "alternative"
435                              | "parallel"
436                              | something-else    ]
437                            EOL
438                          1*body
439                      "#end" EOL
440
441 plaintext    ::=     [ "Content-Description:"
442                            description EOL EOL ]
443                          1*line
444                      [ "#" EOL ]
445
446                    | "#<" type "/" subtype
447                          0*(";" attribute "=" value)
448                          [ "(" comment ")" ]
449                          [ "[" description "]" ]
450                          [ "{" disposition "}" ]
451                          EOL
452                          1*line
453                      [ "#" EOL ]
454
455 line         ::=     "##" text EOL
456                      -- interpreted as "#"text EOL
457                    | text EOL
458 .fi
459 .RE
460 .PP
461
462 .SH FILES
463 .fc ^ ~
464 .nf
465 .ta \w'%etcdir%/ExtraBigFileName  'u
466 ^$HOME/.mmh/profile~^The user profile
467 ^$MHBUILD~^Additional profile entries
468 ^%etcdir%/mhn.defaults~^System default MIME profile entries
469 .fi
470
471 .SH "PROFILE COMPONENTS"
472 .fc ^ ~
473 .nf
474 .ta 2.4i
475 .ta \w'ExtraBigProfileName  'u
476 ^Path:~^To determine the user's mail storage
477 ^Current\-Folder:~^To find the default current folder
478 ^mhbuild-compose-<type>*~^Template for composing contents
479 .fi
480
481 .SH "SEE ALSO"
482 mhlist(1), show(1), mhstore(1), forw(1),
483 .br
484 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
485 (RFC\-2045),
486 .br
487 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
488 (RFC\-2046),
489 .br
490 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
491 (RFC\-2047),
492 .br
493 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
494 (RFC\-2048),
495 .br
496 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
497 (RFC\-2049)
498
499 .SH DEFAULTS
500 .nf
501 .RB ` \-contentid '
502 .RB ` \-noverbose '
503 .fi
504
505 .SH CONTEXT
506 If a folder is given, it will become the current folder.  The last
507 message selected will become the current message.