]> diplodocus.org Git - nmh/blob - man/mhbuild.man
21f7d9c8de95b068b6e4ca8eabb985fe76817235
[nmh] / man / mhbuild.man
1 .TH MHBUILD %manext1% "December 14, 2014" "%nmhversion%"
2 .\"
3 .\" %nmhwarning%
4 .\"
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 [ \-auto " | " \-noauto ]
13 .RB [ \-list " | " \-nolist ]
14 .RB [ \-realsize " | " \-norealsize ]
15 .RB [ \-headers " | " \-noheaders ]
16 .RB [ \-directives " | " \-nodirectives ]
17 .RB [ \-rfc934mode " | " \-norfc934mode ]
18 .RB [ \-contentid " | " \-nocontentid ]
19 .RB [ \-verbose " | " \-noverbose ]
20 .RB [ \-disposition " | " \-nodisposition ]
21 .RB [ \-check " | " \-nocheck ]
22 .RB [ \-headerencoding
23 .IR encoding\-algorithm
24 .RB " | " \-autoheaderencoding ]
25 .RB [ \-maxunencoded
26 .IR line\-length ]
27 .RB [ \-dist ]
28 .RB [ \-version ]
29 .RB [ \-help ]
30 .ad
31 .SH DESCRIPTION
32 The
33 .B mhbuild
34 command will translate a MIME composition draft into
35 a valid MIME message.
36 .PP
37 .B mhbuild
38 creates multi-media messages as specified in RFC 2045
39 to RFC 2049. This includes the encoding of message headers as specified
40 by RFC 2047, and the encoding of MIME parameters as specified in RFC 2231.
41 .PP
42 If you specify the name of the composition file as \*(lq-\*(rq,
43 then
44 .B mhbuild
45 will accept the composition draft on the standard
46 input. If the translation of this input is successful,
47 .B mhbuild
48 will output the new MIME message to the standard output. This argument
49 must be the last argument on the command line.
50 .PP
51 Otherwise if the file argument to
52 .B mhbuild
53 is the name of a valid
54 composition file, and the translation is successful,
55 .B mhbuild
56 will replace the original file with the new MIME message. It will rename
57 the original file to start with the \*(lq,\*(rq character and end with the
58 string \*(lq.orig\*(rq, e.g., if you are editing the file \*(lqdraft\*(rq,
59 it will be renamed to \*(lq,draft.orig\*(rq. This allows you to easily
60 recover the
61 .B mhbuild
62 input file.
63 .SS "Listing the Contents"
64 The
65 .B \-list
66 switch tells
67 .B mhbuild
68 to list the table of contents associated with the MIME message that is created.
69 .PP
70 The
71 .B \-headers
72 switch indicates
73 that a one-line banner should be displayed above the listing. The
74 .B \-realsize
75 switch tells
76 .B mhbuild
77 to evaluate the \*(lqnative\*(rq
78 (decoded) format of each content prior to listing. This provides an
79 accurate count at the expense of a small delay. If the
80 .B \-verbose
81 switch
82 is present, then the listing will show any \*(lqextra\*(rq information
83 that is present in the message, such as comments in the
84 \*(lqContent-Type\*(rq header.
85 .PP
86 If the
87 .B \-disposition
88 switch is present, then the listing will show any relevant information from
89 the \*(lqContent-Disposition\*(rq header.
90 .SS "Simplified Attachment Interface"
91 For users who wish to simply attach files to text content,
92 .B mhbuild
93 will scan the composition file for \*(lqAttach\*(rq headers. An
94 \*(lqAttach\*(rq header contains a filename that will be appended to the
95 message using normal MIME encapsulation rules. One filename is allowed
96 per \*(lqAttach\*(rq header, but multiple \*(lqAttach\*(rq headers are
97 allowed ber composition file.
98 .PP
99 These files will be appended after any other MIME content, including any
100 content specified by
101 .B mhbuild
102 directives (see below). See
103 .IR send (1)
104 for more details.
105 .PP
106 By default, the Content-Disposition will be \*(lqattachment\*(rq.
107 .B mhbuild
108 looks for user profile and mhn.defaults entries of the form
109 .PP
110 .RS 5
111 mhbuild-disposition-<type>/<subtype>
112 .RE
113 or
114 .RS 5
115 mhbuild-disposition-<type>
116 .RE
117 .PP
118 to supply the disposition value. The only supported values are
119 .I attachment
120 and
121 .IR inline.
122 .SS "Convert Interface"
123 .nr item 1 1
124 The \*(lqconvert\*(rq interface is a powerful mechanism that supports
125 replying to MIME messages. These placeholders are used in the following
126 description:
127 .IP TYPE
128 content type/subtype
129 .IP CONVERTER
130 external program, and any fixed arguments, to convert content, such as
131 from a request to a reply
132 .IP ARGSTRING
133 arguments to pass from
134 .B repl
135 to
136 .I CONVERTER
137 .IP FILE
138 full path of message being replied to
139 .PP
140 .RE
141 The convert support is based on pseudoheaders of the form
142 .PP
143 .RS 5
144 Nmh-mhbuild-file-TYPE: FILE
145 Nmh-mhbuild-args-TYPE: ARGSTRING
146 .RE
147 .PP
148 in the draft. For each such pseudoheader, mhbuild looks in the
149 profile and mhn.defaults for this corresponding TYPE entry to find the
150 converter that supports it:
151 .PP
152 .RS 5
153 .RI mhbuild-convert- TYPE :
154 .I CONVERTER
155 .RE
156 .PP
157 It's a fatal error if no such entry is found for TYPE. An empty
158 entry, e.g.,
159 .PP
160 .RS 5
161 mhbuild-convert-text/html:
162 .RE
163 .PP
164 excludes parts of that TYPE from the draft. The mhn.defaults file
165 contains default
166 .B mhbuild-convert-text/html
167 and
168 .BR mhbuild-convert-text/plain
169 entries. Profile entries can be used to override corresponding
170 mhn.defaults entries, as usual.
171 .PP
172 For each
173 .I TYPE
174 part in
175 .IR FILE ,
176 .B mhbuild
177 runs
178 .I CONVERTER ARGSTRING
179 on the content of the part.
180 .PP
181 Each part in
182 .I FILE
183 that has no corresponding TYPE entry in the profile or mhn.defaults is
184 excluded from the draft; the user can include them using mhbuild
185 directives as usual.
186 .PP
187 .B repl
188 inserts Nmh-mhbuild-text/html: and Nmh-mhbuild-text/plain:
189 pseudoheaders in every draft. The user can prevent insertion of
190 content parts of either of those types by putting corresponding empty
191 entries in their profile.
192 .PP
193 Only the highest precedence alternative with a supported
194 .I TYPE
195 of a multipart/alternative part is used.
196 .PP
197 mhn.defaults.sh selects the text/html-to-text/plain converter at
198 install time. It includes
199 .BR iconv "(1),"
200 and
201 .BR par (1)
202 or
203 .BR fmt "(1),"
204 in the pipeline only if found.
205 .PP
206 Some content types require the addition of parameters to the
207 Content-Type header, such as
208 .I method=REPLY
209 for text/calendar. mhbuild looks for a Content-Type header, followed
210 by a blank line, at the beginning of the converter output. If one is
211 found, it is used for the corresponding part in the reply draft.
212 .PP
213 The \*(lqconvert\*(rq interface doesn't support different
214 .IR ARGSTRING s
215 or different converters for different parts of the same
216 .IR TYPE .
217 That would require associating parts by part number with the
218 .IR ARGSTRING s
219 or converters. Instead, that can be done (currently, without using
220 the convert support), with
221 .B mhbuild
222 directives as described below, e.g.,
223 .PP
224 .RS 5
225 #text/html; charset=utf-8 *8bit | mhstore -noverbose -part 42.7 -outfile - | w3m -dump -cols 64 -T text/html -O utf-8
226 .RE
227 .PP
228 The only way to mix
229 .B convert
230 pseudoheaders and mhbuild directives is to insert the directives before
231 .B mhbuild
232 is run, which is typically done by entering
233 .I mime
234 at the \*(lqWhat now?\*(rq prompt, or with an
235 .B \-editor mhbuild
236 switch.
237 .PP
238 These (optional) setup steps can make the convert support
239 easier to use:
240 .IP \n[item]. 3
241 If the
242 .BR par (1)
243 program is installed on your system, it will be set by default
244 (in mhn.defaults) to filter the converter output. It helps to
245 set the
246 .B $PARINIT
247 environment variable, as described in its man page.
248 .IP \n+[item]. 3
249 Add this line to your profile:
250 .PP
251 .RS 5
252 .nf
253 mhbuild-next: $EDITOR
254 .fi
255 .RE
256 .PP
257 .RS 3
258 assuming that your EDTIOR environment variable is set; if not, replace
259 $EDITOR with the name of your editor. Without that profile entry, a
260 response of \*(lqe[dit]\*(rq at the What now? prompt will require
261 specification of your editor if an
262 .B \-editor mhbuild
263 switch is used.
264 .RE
265 .IP \n+[item]. 3
266 If using
267 .BR repl ,
268 source the Bourne-shell compatible functions in
269 .IR %docdir%/contrib/replaliases .
270 .br
271 That script also sets the
272 .B $PARINIT
273 environment variable if it was not set.
274 .RE
275 .PP
276 .SS "Translating the Composition File"
277 .B mhbuild
278 is essentially a filter to aid in the composition of MIME
279 messages.
280 .B mhbuild
281 will convert an
282 .B mhbuild
283 \*(lqcomposition file\*(rq
284 into a valid MIME message. A
285 .B mhbuild
286 \*(lqcomposition file\*(rq
287 is just a file containing plain text that is interspersed
288 with various
289 .B mhbuild
290 directives. When this file is processed
291 by
292 .BR mhbuild ,
293 the various directives will be expanded to the
294 appropriate content, and will be encoded according to the MIME standards.
295 The resulting MIME message can then be sent by electronic mail.
296 .PP
297 The formal syntax for a
298 .B mhbuild
299 composition file is defined at the
300 end of this document, but the ideas behind this format are not complex.
301 Basically, the body contains one or more contents. A content consists of
302 either a directive, indicated with a \*(lq#\*(rq as the first character
303 of a line; or, plaintext (one or more lines of text). The continuation
304 character, \*(lq\\\*(lq, may be used to enter a single directive on more
305 than one line, e.g.,
306 .PP
307 .RS 5
308 .nf
309 #image/png \\
310 /home/foobar/junk/picture.png
311 .fi
312 .RE
313 .PP
314 There are five kinds of directives: \*(lqtype\*(rq directives, which
315 name the type and subtype of the content; \*(lqexternal-type\*(rq
316 directives, which also name the type and subtype of the content; the
317 \*(lqmessage\*(rq directive (#forw), which is used to forward one or
318 more messages; the \*(lqbegin\*(rq directive (#begin), which is
319 used to create a multipart content; and the \*(lqon/off/pop\*(rq
320 directives (#on, #off, #pop) which control whether any other
321 directives are honored at all.
322 .PP
323 The
324 .B \-directives
325 switch allows control over whether mhbuild will honor any of the
326 \*(lq#\*(rq-directives. This can also be affected with the #on or
327 #off directives, and #pop, which restores the state of processing to
328 that preceding the most recent #on or #off. (The #on, #off, and #pop
329 directives are always honored, of course.) This allows inclusion of
330 plain text which looks like mhbuild directives, without causing
331 errors:
332 .PP
333 .RS 5
334 .nf
335 #off
336 #include <stdio.h>
337 printf("Hello, World!");
338 #pop
339 .fi
340 .RE
341 .PP
342 Currently the stack depth for the #on/off/pop directives is 32.
343 .PP
344 The \*(lqtype\*(rq directive is used to directly specify the type and
345 subtype of a content. You may only specify discrete types in this manner
346 (can't specify the types multipart or message with this directive).
347 You may optionally specify the name of a file containing the contents
348 in \*(lqnative\*(rq (decoded) format. If this filename starts with the
349 \*(lq|\*(rq character, then it represents a command to execute whose
350 output is captured accordingly.
351 For example,
352 .PP
353 .RS 5
354 .nf
355 #audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
356 .fi
357 .RE
358 .PP
359 If a filename is not given,
360 .B mhbuild
361 will look for information in the
362 user's profile to determine how the different contents should be composed.
363 This is accomplished by consulting a composition string, and executing
364 it under
365 .BR /bin/sh ,
366 with the standard output set to the content.
367 If the
368 .B \-verbose
369 switch is given,
370 .B mhbuild
371 will echo any commands that are used to create contents in this way.
372 .PP
373 The composition string may contain the following escapes:
374 .PP
375 .RS 5
376 .nf
377 .ta \w'%P 'u
378 %a Insert parameters from directive
379 %f Insert filename containing content
380 %F %f, and stdout is not re-directed
381 %s Insert content subtype
382 %% Insert character %
383 .fi
384 .RE
385 .PP
386 First,
387 .B mhbuild
388 will look for an entry of the form:
389 .PP
390 .RS 5
391 mhbuild-compose-<type>/<subtype>
392 .RE
393 .PP
394 to determine the command to use to compose the content. If this isn't
395 found,
396 .B mhbuild
397 will look for an entry of the form:
398 .PP
399 .RS 5
400 mhbuild-compose-<type>
401 .RE
402 .PP
403 to determine the composition command. If this isn't found,
404 .B mhbuild
405 will complain.
406 .PP
407 An example entry might be:
408 .PP
409 .RS 5
410 mhbuild-compose-audio/basic: record | raw2audio -F
411 .RE
412 .PP
413 Because commands like these will vary, depending on the display
414 environment used for login, composition strings for different
415 contents should probably be put in the file specified by the
416 .B $MHBUILD
417 environment variable, instead of directly in your
418 user profile.
419 .PP
420 The \*(lqexternal-type\*(rq directives are used to provide a MIME
421 reference to a content, rather than enclosing the contents itself
422 (for instance, by specifying an ftp site). Hence, instead of
423 providing a filename as with the type directives, external-parameters
424 are supplied. These look like regular parameters, so they must be
425 separated accordingly. For example,
426 .PP
427 .RS 5
428 .nf
429 #@application/octet-stream; \\
430 type=tar; \\
431 conversions=compress \\
432 [this is the nmh distribution] \\
433 {attachment; filename="nmh.tar.gz"} \\
434 name="nmh.tar.gz"; \\
435 directory="/pub/nmh"; \\
436 site="ftp.math.gatech.edu"; \\
437 access-type=anon-ftp; \\
438 mode="image"
439 .fi
440 .RE
441 .PP
442 You must give a description string to separate the content parameters
443 from the external-parameters (although this string may be empty).
444 This description string is specified by enclosing it within
445 \*(lq[]\*(rq. A disposition string, to appear in a
446 \*(lqContent-Disposition\*(rq header, may appear in the optional
447 \*(lq{}\*(rq.
448 .PP
449 These parameters are of the form:
450 .PP
451 .RS 5
452 .nf
453 .ta \w'access-type= 'u
454 access-type= usually \fIanon-ftp\fR, \fImail-server\fR, or \fIurl\fR
455 name= filename
456 permission= read-only or read-write
457 site= hostname
458 directory= directoryname (optional)
459 mode= usually \fIascii\fR or \fIimage\fR (optional)
460 size= number of octets
461 server= mailbox
462 subject= subject to send
463 body= command to send for retrieval
464 url= URL of content
465 .fi
466 .RE
467 .PP
468 A mimimum \*(lqexternal\-type\*(rq directive for the
469 .B url
470 .I access\-type
471 would be as follows:
472 .PP
473 .RS 3
474 .nf
475 #@application/octet-stream [] access-type=url; \\
476 url="http://download.savannah.gnu.org/releases/nmh/nmh-1.5.tar.gz"
477 .fi
478 .RE
479 .PP
480 Any long URLs will be wrapped according to RFC 2231 rules.
481 .PP
482 The \*(lqmessage\*(rq directive (#forw) is used to specify a message or
483 group of messages to include. You may optionally specify the name of
484 the folder and which messages are to be forwarded. If a folder is not
485 given, it defaults to the current folder. Similarly, if a message is not
486 given, it defaults to the current message. Hence, the message directive
487 is similar to the
488 .B forw
489 command, except that the former uses
490 the MIME rules for encapsulation rather than those specified in RFC 934.
491 For example,
492 .PP
493 .RS 5
494 .nf
495 #forw +inbox 42 43 99
496 .fi
497 .RE
498 .PP
499 If you include a single message, it will be included directly as a content
500 of type \*(lqmessage/rfc822\*(rq. If you include more than one message,
501 then
502 .B mhbuild
503 will add a content of type \*(lqmultipart/digest\*(rq
504 and include each message as a subpart of this content.
505 .PP
506 If you are using this directive to include more than one message, you
507 may use the
508 .B \-rfc934mode
509 switch. This switch will indicate that
510 .B mhbuild
511 should attempt to utilize the MIME encapsulation rules
512 in such a way that the \*(lqmultipart/digest\*(rq that is created
513 is (mostly) compatible with the encapsulation specified in RFC 934.
514 If given, then RFC 934 compliant user-agents should be able to burst the
515 message on reception\0--\0providing that the messages being encapsulated
516 do not contain encapsulated messages themselves. The drawback of this
517 approach is that the encapsulations are generated by placing an extra
518 newline at the end of the body of each message.
519 .PP
520 The \*(lqbegin\*(rq directive is used to create a multipart content.
521 When using the \*(lqbegin\*(rq directive, you must specify at least one
522 content between the begin and end pairs.
523 .PP
524 .RS 5
525 .nf
526 #begin
527 This will be a multipart with only one part.
528 #end
529 .fi
530 .RE
531 .PP
532 If you use multiple directives in a composition draft,
533 .B mhbuild
534 will
535 automatically encapsulate them inside a multipart content. Therefore the
536 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
537 multiparts, or create a multipart message containing only one part.
538 .PP
539 For all of these directives, the user may include a brief description
540 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
541 character. This description will be copied into the
542 \*(lqContent-Description\*(rq header when the directive is processed.
543 .PP
544 .RS 5
545 .nf
546 #forw [important mail from Bob] +bob 1 2 3 4 5
547 .fi
548 .RE
549 .PP
550 Similarly, a disposition string may optionally be provided between
551 \*(lq{\*(rq and \*(lq}\*(rq characters; it will be copied into the
552 \*(lqContent-Disposition\*(rq header when the directive is processed.
553 If a disposition string is provided that does not contain a filename
554 parameter, and a filename is provided in the directive, it will be
555 added to the \*(lqContent-Disposition\*(rq header. For example, the
556 following directive:
557 .PP
558 .RS 5
559 .nf
560 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
561 .fi
562 .RE
563 .PP
564 creates these message part headers:
565 .PP
566 .RS 5
567 .nf
568 Content-Type: text/plain; charset="iso-8859-1"
569 Content-Disposition: attachment; filename="summary.txt"
570 .fi
571 .RE
572 .PP
573 By default,
574 .B mhbuild
575 will generate a unique \*(lqContent-ID:\*(rq for each directive,
576 corresponding to each message part; however, the user may override
577 this by defining the ID using the \*(lq<\*(rq and \*(lq>\*(rq
578 characters. The
579 .B \-nocontentid
580 switch suppresses creation of all \*(lqContent-ID:\*(rq headers,
581 even in the top level of the message.
582 .PP
583 Normally
584 .B mhbuild
585 will choose an appropriate Content\-Transfer\-Encoding based on the content
586 and the MIME Content\-Type. However, you can override that in an
587 .B mhbuild
588 directive by specifying \*(lq*\*(rq and the encoding. Acceptable encoding
589 values are \*(lq8bit\*(rq, \*(lqqp\*(rq (for quoted\-printable), and
590 \*(lqb64\*(rq (for base64 encoding). It should be noted that undesired
591 results may occur if 8bit or quoted\-printable is selected for binary
592 content, due to the translation between Unix line endings and the line
593 endings use by the mail transport system.
594 .PP
595 In addition to the various directives, plaintext can be present.
596 Plaintext is gathered, until a directive is found or the draft is
597 exhausted, and this is made to form a text content. If the plaintext
598 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
599 e.g.,
600 .PP
601 .RS 5
602 ##when sent, this line will start with only one #
603 .RE
604 .PP
605 If you want to end the plaintext prior to a directive, e.g., to have two
606 plaintext contents adjacent, simply insert a line containing a single
607 \*(lq#\*(rq character, e.g.,
608 .PP
609 .RS 5
610 .nf
611 this is the first content
612 #
613 and this is the second
614 .fi
615 .RE
616 .PP
617 Finally, if the plaintext starts with a line of the form:
618 .PP
619 .RS 5
620 Content-Description: text
621 .RE
622 .PP
623 then this will be used to describe the plaintext content.
624 You MUST follow this line with a blank line before starting
625 your text.
626 .PP
627 By default, plaintext is captured as a text/plain content. You can
628 override this by starting the plaintext with \*(lq#<\*(rq followed by
629 a content-type specification. For example, e.g.,
630 .PP
631 .RS 5
632 .nf
633 #<text/enriched
634 this content will be tagged as text/enriched
635 #
636 and this content will be tagged as text/plain
637 #
638 #<application/x-patch [this is a patch]
639 and this content will be tagged as application/x-patch
640 .fi
641 .RE
642 .PP
643 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
644 content-description must be on the same line which identifies the content
645 type of the plaintext.
646 .PP
647 When composing a text content, you may indicate the relevant character
648 set by adding the \*(lqcharset\*(rq parameter to the directive.
649 .PP
650 .RS 5
651 #<text/plain; charset=iso-8859-5
652 .RE
653 .PP
654 If a text content contains any 8\-bit characters (characters with the
655 high bit set) and the character set is not specified as above, then
656 .B mhbuild
657 will assume the character set is of the type given by the
658 standard
659 .IR locale (1)
660 environment variables. If these environment variables are not
661 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
662 .PP
663 If a text content contains only 7\-bit characters and the character set
664 is not specified as above, then the character set will be labeled as
665 \*(lqus-ascii\*(rq.
666 .PP
667 By default text content with the high bit set is encoded with a 8bit
668 Content\-Transfer\-Encoding. If the text has lines longer than the value
669 of
670 .B \-maxunencoded
671 (which defaults to 78) then the text is encoded using the quoted\-printable
672 encoding.
673 .PP
674 The
675 .B \-headerencoding
676 switch will indicate which algorithm to use when encoding any message headers
677 that contain 8\-bit characters. The valid arguments are
678 .I base64
679 for based\-64 encoding and
680 .I quoted
681 for quoted\-printable encoding. The
682 .B \-autoheaderencoding
683 switch will instruct
684 .B mhbuild
685 to automatically pick the algorithm that results in a shorter encoded string.
686 .PP
687 Putting this all together,
688 here is an example of a more complicated message draft. The
689 following draft will expand into a multipart/mixed message
690 containing five parts:
691 .PP
692 .RS 5
693 .nf
694 To: nobody@nowhere.org
695 cc:
696 Subject: Look and listen to me!
697 --------
698 The first part will be text/plain
699 #<text/enriched
700 The second part will be text/enriched
701 #
702 This third part will be text/plain
703 #audio/basic [silly giggle] \\
704 |raw2audio -F < /usr/lib/sounds/giggle.au
705 #image/gif [photo of foobar] \\
706 /home/foobar/lib/picture.gif
707 .fi
708 .RE
709 .SS "Integrity Check"
710 If
711 .B mhbuild
712 is given the
713 .B \-check
714 switch, then it will also associate an integrity check with each
715 \*(lqleaf\*(rq content. This will add a Content-MD5 header field to
716 the content, along with the md5 sum of the unencoded contents, per RFC
717 1864. This may be used by the receiver of the message to verify that
718 the contents of the message were not changed in transport.
719 .SS "Transfer Encodings"
720 After
721 .B mhbuild
722 constructs the new MIME message by parsing directives,
723 including files, etc., it scans the contents of the message to determine
724 which transfer encoding to use. It will check for 8bit data, long lines,
725 spaces at the end of lines, and clashes with multipart boundaries. It will
726 then choose a transfer encoding appropriate for each content type.
727 .PP
728 If an integrity check is being associated with each content by using
729 the
730 .B \-check
731 switch, then
732 .B mhbuild
733 will encode each content with
734 a transfer encoding, even it the content contains only 7\-bit data. This
735 is to increase the likelihood that the content is not changed while in
736 transport.
737 .SS "Invoking mhbuild"
738 Typically,
739 .B mhbuild
740 is invoked by the
741 .B whatnow
742 program. This
743 command will expect the body of the draft to be formatted as an
744 .B mhbuild
745 composition file. Once you have composed this input file
746 using a command such as
747 .BR comp ,
748 .BR repl ,
749 or
750 .BR forw ,
751 you invoke
752 .B mhbuild
753 at the \*(lqWhat now\*(rq prompt with
754 .PP
755 .RS 5
756 What now? mime
757 .RE
758 .PP
759 prior to sending the draft. This will cause
760 .B whatnow
761 to execute
762 .B mhbuild
763 to translate the composition file into MIME format.
764 .PP
765 Normally it is an error to invoke
766 .B mhbuild
767 on file that already in MIME format. The
768 .B \-auto
769 switch will cause
770 .B mhbuild
771 to exit without error if the input file already has valid MIME headers.
772 The use of
773 .B \-auto
774 also enables the
775 .B \-nodirectives
776 switch.
777 .PP
778 Finally, you should consider adding this line to your profile:
779 .PP
780 .RS 5
781 lproc: show
782 .RE
783 .PP
784 This way, if you decide to
785 .B list
786 after invoking
787 .BR mime ,
788 the command
789 .PP
790 .RS 5
791 What now? list
792 .RE
793 .PP
794 will work as you expect.
795 .PP
796 The
797 .B \-dist
798 switch is intended to be used by
799 .BR dist .
800 It will cause mhbuild to not generate any MIME headers in the composition
801 file (such as \*(lqMIME-Version\*(rq or \*(lqContent-Type\*(rq), but it
802 will still encode message headers according to RFC 2047.
803 .SS "User Environment"
804 Because the environment in which
805 .B mhbuild
806 operates may vary for a
807 user,
808 .B mhbuild
809 will look for the environment variable
810 .BR $MHBUILD .
811 If present, this specifies the name of an additional user profile which
812 should be read. Hence, when a user logs in on a particular machine,
813 this environment variable should be set to refer to a file containing
814 definitions useful for that machine.
815 .PP
816 Finally,
817 .B mhbuild
818 will attempt to consult
819 .PP
820 .RS 5
821 %nmhetcdir%/mhn.defaults
822 .RE
823 .PP
824 if it exists.
825 .PP
826 See "Profile Lookup" in
827 .IR mh-profile (5)
828 for the profile search order, and for how duplicate entries are treated.
829 .SS "Syntax of Composition Files"
830 The following is the formal syntax of a
831 .B mhbuild
832 \*(lqcomposition file\*(rq.
833 .PP
834 .RS 5
835 .nf
836 body ::= 1*(content | EOL)
837
838 content ::= directive | plaintext
839
840 directive ::= "#" type "/" subtype
841 0*(";" attribute "=" value)
842 [ "(" comment ")" ]
843 [ "<" id ">" ]
844 [ "[" description "]" ]
845 [ "{" disposition "}" ]
846 [ "*8bit" | "*qp" | "*b64" ]
847 [ filename ]
848 EOL
849
850 | "#@" type "/" subtype
851 0*(";" attribute "=" value)
852 [ "(" comment ")" ]
853 [ "<" id ">" ]
854 [ "[" description "]" ]
855 [ "{" disposition "}" ]
856 [ "*8bit" | "*qp" | "*b64" ]
857 external-parameters
858 EOL
859
860 | "#forw"
861 [ "<" id ">" ]
862 [ "[" description "]" ]
863 [ "{" disposition "}" ]
864 [ "+"folder ] [ 0*msg ]
865 EOL
866
867 | "#begin"
868 [ "<" id ">" ]
869 [ "[" description "]" ]
870 [ "{" disposition "}" ]
871 [ "alternative"
872 | "parallel"
873 | something-else ]
874 EOL
875 1*body
876 "#end" EOL
877
878 plaintext ::= [ "Content-Description:"
879 description EOL EOL ]
880 1*line
881 [ "#" EOL ]
882
883 | "#<" type "/" subtype
884 0*(";" attribute "=" value)
885 [ "(" comment ")" ]
886 [ "[" description "]" ]
887 [ "{" disposition "}" ]
888 [ "*8bit" | "*qp" | "*b64" ]
889 EOL
890 1*line
891 [ "#" EOL ]
892
893 line ::= "##" text EOL
894 -- interpreted as "#"text EOL
895 | text EOL
896 .fi
897 .RE
898 .SH FILES
899 .B mhbuild
900 looks for additional user profile files and mhn.defaults in multiple
901 locations: absolute pathnames are accessed directly, tilde expansion
902 is done on usernames, and files are searched for in the user's
903 .I Mail
904 directory as specified in their profile. If not found there, the directory
905 .RI \*(lq %nmhetcdir% \*(rq
906 is checked.
907 .PP
908 .fc ^ ~
909 .nf
910 .ta \w'%nmhetcdir%/ExtraBigFileName 'u
911 ^$HOME/\&.mh\(ruprofile~^The user profile
912 ^$MHBUILD~^Additional profile entries
913 ^%nmhetcdir%/mhn.defaults~^System default MIME profile entries
914 .fi
915 .SH "PROFILE COMPONENTS"
916 .fc ^ ~
917 .nf
918 .ta 2.4i
919 .ta \w'ExtraBigProfileName 'u
920 ^Path:~^To determine the user's nmh directory
921 ^Current\-Folder:~^To find the default current folder
922 ^mhbuild-compose-<type>*~^Template for composing contents
923 .fi
924 .SH "SEE ALSO"
925 .IR mhlist (1),
926 .IR mhshow (1),
927 .IR mhstore (1),
928 .IR fmt (1),
929 .IR iconv (1),
930 .IR par (1)
931 .PP
932 .I "Proposed Standard for Message Encapsulation"
933 (RFC 934),
934 .PP
935 .I "The Content-MD5 Header Field"
936 (RFC 1864),
937 .PP
938 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
939 (RFC 2045),
940 .PP
941 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
942 (RFC 2046),
943 .PP
944 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
945 (RFC 2047),
946 .PP
947 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
948 (RFC 2048),
949 .PP
950 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
951 (RFC 2049),
952 .PP
953 .I "Definition of the URL MIME External-Body Access-Type"
954 (RFC 2017),
955 .PP
956 .I "MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations"
957 (RFC 2231)
958 .SH DEFAULTS
959 .nf
960 .RB ` \-headers '
961 .RB ` \-realsize '
962 .RB ` \-norfc934mode '
963 .RB ` \-contentid '
964 .RB ` \-nocheck '
965 .RB ` \-noverbose '
966 .RB ` \-nodisposition '
967 .RB ` \-autoheaderencoding '
968 .RB ` "\-maxunencoded\ 78"'
969 .fi