]> diplodocus.org Git - nmh/blob - man/mhbuild.man
In expand_pseudoheader(), set Content-Type to 7-bit for ASCII text.
[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 %docdir%/contrib/replaliases. That script also sets the
270 .B $PARINIT
271 environment variable if it was not set.
272 .RE
273 .PP
274 .SS "Translating the Composition File"
275 .B mhbuild
276 is essentially a filter to aid in the composition of MIME
277 messages.
278 .B mhbuild
279 will convert an
280 .B mhbuild
281 \*(lqcomposition file\*(rq
282 into a valid MIME message. A
283 .B mhbuild
284 \*(lqcomposition file\*(rq
285 is just a file containing plain text that is interspersed
286 with various
287 .B mhbuild
288 directives. When this file is processed
289 by
290 .BR mhbuild ,
291 the various directives will be expanded to the
292 appropriate content, and will be encoded according to the MIME standards.
293 The resulting MIME message can then be sent by electronic mail.
294 .PP
295 The formal syntax for a
296 .B mhbuild
297 composition file is defined at the
298 end of this document, but the ideas behind this format are not complex.
299 Basically, the body contains one or more contents. A content consists of
300 either a directive, indicated with a \*(lq#\*(rq as the first character
301 of a line; or, plaintext (one or more lines of text). The continuation
302 character, \*(lq\\\*(lq, may be used to enter a single directive on more
303 than one line, e.g.,
304 .PP
305 .RS 5
306 .nf
307 #image/png \\
308 /home/foobar/junk/picture.png
309 .fi
310 .RE
311 .PP
312 There are five kinds of directives: \*(lqtype\*(rq directives, which
313 name the type and subtype of the content; \*(lqexternal-type\*(rq
314 directives, which also name the type and subtype of the content; the
315 \*(lqmessage\*(rq directive (#forw), which is used to forward one or
316 more messages; the \*(lqbegin\*(rq directive (#begin), which is
317 used to create a multipart content; and the \*(lqon/off/pop\*(rq
318 directives (#on, #off, #pop) which control whether any other
319 directives are honored at all.
320 .PP
321 The
322 .B \-directives
323 switch allows control over whether mhbuild will honor any of the
324 \*(lq#\*(rq-directives. This can also be affected with the #on or
325 #off directives, and #pop, which restores the state of processing to
326 that preceding the most recent #on or #off. (The #on, #off, and #pop
327 directives are always honored, of course.) This allows inclusion of
328 plain text which looks like mhbuild directives, without causing
329 errors:
330 .PP
331 .RS 5
332 .nf
333 #off
334 #include <stdio.h>
335 printf("Hello, World!");
336 #pop
337 .fi
338 .RE
339 .PP
340 Currently the stack depth for the #on/off/pop directives is 32.
341 .PP
342 The \*(lqtype\*(rq directive is used to directly specify the type and
343 subtype of a content. You may only specify discrete types in this manner
344 (can't specify the types multipart or message with this directive).
345 You may optionally specify the name of a file containing the contents
346 in \*(lqnative\*(rq (decoded) format. If this filename starts with the
347 \*(lq|\*(rq character, then it represents a command to execute whose
348 output is captured accordingly.
349 For example,
350 .PP
351 .RS 5
352 .nf
353 #audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
354 .fi
355 .RE
356 .PP
357 If a filename is not given,
358 .B mhbuild
359 will look for information in the
360 user's profile to determine how the different contents should be composed.
361 This is accomplished by consulting a composition string, and executing
362 it under
363 .BR /bin/sh ,
364 with the standard output set to the content.
365 If the
366 .B \-verbose
367 switch is given,
368 .B mhbuild
369 will echo any commands that are used to create contents in this way.
370 .PP
371 The composition string may contain the following escapes:
372 .PP
373 .RS 5
374 .nf
375 .ta \w'%P 'u
376 %a Insert parameters from directive
377 %f Insert filename containing content
378 %F %f, and stdout is not re-directed
379 %s Insert content subtype
380 %% Insert character %
381 .fi
382 .RE
383 .PP
384 First,
385 .B mhbuild
386 will look for an entry of the form:
387 .PP
388 .RS 5
389 mhbuild-compose-<type>/<subtype>
390 .RE
391 .PP
392 to determine the command to use to compose the content. If this isn't
393 found,
394 .B mhbuild
395 will look for an entry of the form:
396 .PP
397 .RS 5
398 mhbuild-compose-<type>
399 .RE
400 .PP
401 to determine the composition command. If this isn't found,
402 .B mhbuild
403 will complain.
404 .PP
405 An example entry might be:
406 .PP
407 .RS 5
408 mhbuild-compose-audio/basic: record | raw2audio -F
409 .RE
410 .PP
411 Because commands like these will vary, depending on the display
412 environment used for login, composition strings for different
413 contents should probably be put in the file specified by the
414 .B $MHBUILD
415 environment variable, instead of directly in your
416 user profile.
417 .PP
418 The \*(lqexternal-type\*(rq directives are used to provide a MIME
419 reference to a content, rather than enclosing the contents itself
420 (for instance, by specifying an ftp site). Hence, instead of
421 providing a filename as with the type directives, external-parameters
422 are supplied. These look like regular parameters, so they must be
423 separated accordingly. For example,
424 .PP
425 .RS 5
426 .nf
427 #@application/octet-stream; \\
428 type=tar; \\
429 conversions=compress \\
430 [this is the nmh distribution] \\
431 {attachment; filename="nmh.tar.gz"} \\
432 name="nmh.tar.gz"; \\
433 directory="/pub/nmh"; \\
434 site="ftp.math.gatech.edu"; \\
435 access-type=anon-ftp; \\
436 mode="image"
437 .fi
438 .RE
439 .PP
440 You must give a description string to separate the content parameters
441 from the external-parameters (although this string may be empty).
442 This description string is specified by enclosing it within
443 \*(lq[]\*(rq. A disposition string, to appear in a
444 \*(lqContent-Disposition\*(rq header, may appear in the optional
445 \*(lq{}\*(rq.
446 .PP
447 These parameters are of the form:
448 .PP
449 .RS 5
450 .nf
451 .ta \w'access-type= 'u
452 access-type= usually \fIanon-ftp\fR, \fImail-server\fR, or \fIurl\fR
453 name= filename
454 permission= read-only or read-write
455 site= hostname
456 directory= directoryname (optional)
457 mode= usually \fIascii\fR or \fIimage\fR (optional)
458 size= number of octets
459 server= mailbox
460 subject= subject to send
461 body= command to send for retrieval
462 url= URL of content
463 .fi
464 .RE
465 .PP
466 A mimimum \*(lqexternal\-type\*(rq directive for the
467 .B url
468 .I access\-type
469 would be as follows:
470 .PP
471 .RS 3
472 .nf
473 #@application/octet-stream [] access-type=url; \\
474 url="http://download.savannah.gnu.org/releases/nmh/nmh-1.5.tar.gz"
475 .fi
476 .RE
477 .PP
478 Any long URLs will be wrapped according to RFC 2231 rules.
479 .PP
480 The \*(lqmessage\*(rq directive (#forw) is used to specify a message or
481 group of messages to include. You may optionally specify the name of
482 the folder and which messages are to be forwarded. If a folder is not
483 given, it defaults to the current folder. Similarly, if a message is not
484 given, it defaults to the current message. Hence, the message directive
485 is similar to the
486 .B forw
487 command, except that the former uses
488 the MIME rules for encapsulation rather than those specified in RFC 934.
489 For example,
490 .PP
491 .RS 5
492 .nf
493 #forw +inbox 42 43 99
494 .fi
495 .RE
496 .PP
497 If you include a single message, it will be included directly as a content
498 of type \*(lqmessage/rfc822\*(rq. If you include more than one message,
499 then
500 .B mhbuild
501 will add a content of type \*(lqmultipart/digest\*(rq
502 and include each message as a subpart of this content.
503 .PP
504 If you are using this directive to include more than one message, you
505 may use the
506 .B \-rfc934mode
507 switch. This switch will indicate that
508 .B mhbuild
509 should attempt to utilize the MIME encapsulation rules
510 in such a way that the \*(lqmultipart/digest\*(rq that is created
511 is (mostly) compatible with the encapsulation specified in RFC 934.
512 If given, then RFC 934 compliant user-agents should be able to burst the
513 message on reception\0--\0providing that the messages being encapsulated
514 do not contain encapsulated messages themselves. The drawback of this
515 approach is that the encapsulations are generated by placing an extra
516 newline at the end of the body of each message.
517 .PP
518 The \*(lqbegin\*(rq directive is used to create a multipart content.
519 When using the \*(lqbegin\*(rq directive, you must specify at least one
520 content between the begin and end pairs.
521 .PP
522 .RS 5
523 .nf
524 #begin
525 This will be a multipart with only one part.
526 #end
527 .fi
528 .RE
529 .PP
530 If you use multiple directives in a composition draft,
531 .B mhbuild
532 will
533 automatically encapsulate them inside a multipart content. Therefore the
534 \*(lqbegin\*(rq directive is only necessary if you wish to use nested
535 multiparts, or create a multipart message containing only one part.
536 .PP
537 For all of these directives, the user may include a brief description
538 of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
539 character. This description will be copied into the
540 \*(lqContent-Description\*(rq header when the directive is processed.
541 .PP
542 .RS 5
543 .nf
544 #forw [important mail from Bob] +bob 1 2 3 4 5
545 .fi
546 .RE
547 .PP
548 Similarly, a disposition string may optionally be provided between
549 \*(lq{\*(rq and \*(lq}\*(rq characters; it will be copied into the
550 \*(lqContent-Disposition\*(rq header when the directive is processed.
551 If a disposition string is provided that does not contain a filename
552 parameter, and a filename is provided in the directive, it will be
553 added to the \*(lqContent-Disposition\*(rq header. For example, the
554 following directive:
555 .PP
556 .RS 5
557 .nf
558 #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt
559 .fi
560 .RE
561 .PP
562 creates these message part headers:
563 .PP
564 .RS 5
565 .nf
566 Content-Type: text/plain; charset="iso-8859-1"
567 Content-Disposition: attachment; filename="summary.txt"
568 .fi
569 .RE
570 .PP
571 By default,
572 .B mhbuild
573 will generate a unique \*(lqContent-ID:\*(rq for each directive,
574 corresponding to each message part; however, the user may override
575 this by defining the ID using the \*(lq<\*(rq and \*(lq>\*(rq
576 characters. The
577 .B \-nocontentid
578 switch suppresses creation of all \*(lqContent-ID:\*(rq headers,
579 even in the top level of the message.
580 .PP
581 Normally
582 .B mhbuild
583 will choose an appropriate Content\-Transfer\-Encoding based on the content
584 and the MIME Content\-Type. However, you can override that in an
585 .B mhbuild
586 directive by specifying \*(lq*\*(rq and the encoding. Acceptable encoding
587 values are \*(lq8bit\*(rq, \*(lqqp\*(rq (for quoted\-printable), and
588 \*(lqb64\*(rq (for base64 encoding). It should be noted that undesired
589 results may occur if 8bit or quoted\-printable is selected for binary
590 content, due to the translation between Unix line endings and the line
591 endings use by the mail transport system.
592 .PP
593 In addition to the various directives, plaintext can be present.
594 Plaintext is gathered, until a directive is found or the draft is
595 exhausted, and this is made to form a text content. If the plaintext
596 must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
597 e.g.,
598 .PP
599 .RS 5
600 ##when sent, this line will start with only one #
601 .RE
602 .PP
603 If you want to end the plaintext prior to a directive, e.g., to have two
604 plaintext contents adjacent, simply insert a line containing a single
605 \*(lq#\*(rq character, e.g.,
606 .PP
607 .RS 5
608 .nf
609 this is the first content
610 #
611 and this is the second
612 .fi
613 .RE
614 .PP
615 Finally, if the plaintext starts with a line of the form:
616 .PP
617 .RS 5
618 Content-Description: text
619 .RE
620 .PP
621 then this will be used to describe the plaintext content.
622 You MUST follow this line with a blank line before starting
623 your text.
624 .PP
625 By default, plaintext is captured as a text/plain content. You can
626 override this by starting the plaintext with \*(lq#<\*(rq followed by
627 a content-type specification. For example, e.g.,
628 .PP
629 .RS 5
630 .nf
631 #<text/enriched
632 this content will be tagged as text/enriched
633 #
634 and this content will be tagged as text/plain
635 #
636 #<application/x-patch [this is a patch]
637 and this content will be tagged as application/x-patch
638 .fi
639 .RE
640 .PP
641 Note that if you use the \*(lq#<\*(rq plaintext-form, then the
642 content-description must be on the same line which identifies the content
643 type of the plaintext.
644 .PP
645 When composing a text content, you may indicate the relevant character
646 set by adding the \*(lqcharset\*(rq parameter to the directive.
647 .PP
648 .RS 5
649 #<text/plain; charset=iso-8859-5
650 .RE
651 .PP
652 If a text content contains any 8\-bit characters (characters with the
653 high bit set) and the character set is not specified as above, then
654 .B mhbuild
655 will assume the character set is of the type given by the
656 standard
657 .IR locale (1)
658 environment variables. If these environment variables are not
659 set, then the character set will be labeled as \*(lqx-unknown\*(rq.
660 .PP
661 If a text content contains only 7\-bit characters and the character set
662 is not specified as above, then the character set will be labeled as
663 \*(lqus-ascii\*(rq.
664 .PP
665 By default text content with the high bit set is encoded with a 8bit
666 Content\-Transfer\-Encoding. If the text has lines longer than the value
667 of
668 .B \-maxunencoded
669 (which defaults to 78) then the text is encoded using the quoted\-printable
670 encoding.
671 .PP
672 The
673 .B \-headerencoding
674 switch will indicate which algorithm to use when encoding any message headers
675 that contain 8\-bit characters. The valid arguments are
676 .I base64
677 for based\-64 encoding and
678 .I quoted
679 for quoted\-printable encoding. The
680 .B \-autoheaderencoding
681 switch will instruct
682 .B mhbuild
683 to automatically pick the algorithm that results in a shorter encoded string.
684 .PP
685 Putting this all together,
686 here is an example of a more complicated message draft. The
687 following draft will expand into a multipart/mixed message
688 containing five parts:
689 .PP
690 .RS 5
691 .nf
692 To: nobody@nowhere.org
693 cc:
694 Subject: Look and listen to me!
695 --------
696 The first part will be text/plain
697 #<text/enriched
698 The second part will be text/enriched
699 #
700 This third part will be text/plain
701 #audio/basic [silly giggle] \\
702 |raw2audio -F < /usr/lib/sounds/giggle.au
703 #image/gif [photo of foobar] \\
704 /home/foobar/lib/picture.gif
705 .fi
706 .RE
707 .SS "Integrity Check"
708 If
709 .B mhbuild
710 is given the
711 .B \-check
712 switch, then it will also associate an integrity check with each
713 \*(lqleaf\*(rq content. This will add a Content-MD5 header field to
714 the content, along with the md5 sum of the unencoded contents, per RFC
715 1864. This may be used by the receiver of the message to verify that
716 the contents of the message were not changed in transport.
717 .SS "Transfer Encodings"
718 After
719 .B mhbuild
720 constructs the new MIME message by parsing directives,
721 including files, etc., it scans the contents of the message to determine
722 which transfer encoding to use. It will check for 8bit data, long lines,
723 spaces at the end of lines, and clashes with multipart boundaries. It will
724 then choose a transfer encoding appropriate for each content type.
725 .PP
726 If an integrity check is being associated with each content by using
727 the
728 .B \-check
729 switch, then
730 .B mhbuild
731 will encode each content with
732 a transfer encoding, even it the content contains only 7\-bit data. This
733 is to increase the likelihood that the content is not changed while in
734 transport.
735 .SS "Invoking mhbuild"
736 Typically,
737 .B mhbuild
738 is invoked by the
739 .B whatnow
740 program. This
741 command will expect the body of the draft to be formatted as an
742 .B mhbuild
743 composition file. Once you have composed this input file
744 using a command such as
745 .BR comp ,
746 .BR repl ,
747 or
748 .BR forw ,
749 you invoke
750 .B mhbuild
751 at the \*(lqWhat now\*(rq prompt with
752 .PP
753 .RS 5
754 What now? mime
755 .RE
756 .PP
757 prior to sending the draft. This will cause
758 .B whatnow
759 to execute
760 .B mhbuild
761 to translate the composition file into MIME format.
762 .PP
763 Normally it is an error to invoke
764 .B mhbuild
765 on file that already in MIME format. The
766 .B \-auto
767 switch will cause
768 .B mhbuild
769 to exit without error if the input file already has valid MIME headers.
770 The use of
771 .B \-auto
772 also enables the
773 .B \-nodirectives
774 switch.
775 .PP
776 Finally, you should consider adding this line to your profile:
777 .PP
778 .RS 5
779 lproc: show
780 .RE
781 .PP
782 This way, if you decide to
783 .B list
784 after invoking
785 .BR mime ,
786 the command
787 .PP
788 .RS 5
789 What now? list
790 .RE
791 .PP
792 will work as you expect.
793 .PP
794 The
795 .B \-dist
796 switch is intended to be used by
797 .BR dist .
798 It will cause mhbuild to not generate any MIME headers in the composition
799 file (such as \*(lqMIME-Version\*(rq or \*(lqContent-Type\*(rq), but it
800 will still encode message headers according to RFC 2047.
801 .SS "User Environment"
802 Because the environment in which
803 .B mhbuild
804 operates may vary for a
805 user,
806 .B mhbuild
807 will look for the environment variable
808 .BR $MHBUILD .
809 If present, this specifies the name of an additional user profile which
810 should be read. Hence, when a user logs in on a particular machine,
811 this environment variable should be set to refer to a file containing
812 definitions useful for that machine.
813 .PP
814 Finally,
815 .B mhbuild
816 will attempt to consult
817 .PP
818 .RS 5
819 %nmhetcdir%/mhn.defaults
820 .RE
821 .PP
822 if it exists.
823 .PP
824 See "Profile Lookup" in
825 .IR mh-profile (5)
826 for the profile search order, and for how duplicate entries are treated.
827 .SS "Syntax of Composition Files"
828 The following is the formal syntax of a
829 .B mhbuild
830 \*(lqcomposition file\*(rq.
831 .PP
832 .RS 5
833 .nf
834 body ::= 1*(content | EOL)
835
836 content ::= directive | plaintext
837
838 directive ::= "#" type "/" subtype
839 0*(";" attribute "=" value)
840 [ "(" comment ")" ]
841 [ "<" id ">" ]
842 [ "[" description "]" ]
843 [ "{" disposition "}" ]
844 [ "*8bit" | "*qp" | "*b64" ]
845 [ filename ]
846 EOL
847
848 | "#@" type "/" subtype
849 0*(";" attribute "=" value)
850 [ "(" comment ")" ]
851 [ "<" id ">" ]
852 [ "[" description "]" ]
853 [ "{" disposition "}" ]
854 [ "*8bit" | "*qp" | "*b64" ]
855 external-parameters
856 EOL
857
858 | "#forw"
859 [ "<" id ">" ]
860 [ "[" description "]" ]
861 [ "{" disposition "}" ]
862 [ "+"folder ] [ 0*msg ]
863 EOL
864
865 | "#begin"
866 [ "<" id ">" ]
867 [ "[" description "]" ]
868 [ "{" disposition "}" ]
869 [ "alternative"
870 | "parallel"
871 | something-else ]
872 EOL
873 1*body
874 "#end" EOL
875
876 plaintext ::= [ "Content-Description:"
877 description EOL EOL ]
878 1*line
879 [ "#" EOL ]
880
881 | "#<" type "/" subtype
882 0*(";" attribute "=" value)
883 [ "(" comment ")" ]
884 [ "[" description "]" ]
885 [ "{" disposition "}" ]
886 [ "*8bit" | "*qp" | "*b64" ]
887 EOL
888 1*line
889 [ "#" EOL ]
890
891 line ::= "##" text EOL
892 -- interpreted as "#"text EOL
893 | text EOL
894 .fi
895 .RE
896 .SH FILES
897 .B mhbuild
898 looks for additional user profile files and mhn.defaults in multiple
899 locations: absolute pathnames are accessed directly, tilde expansion
900 is done on usernames, and files are searched for in the user's
901 .I Mail
902 directory as specified in their profile. If not found there, the directory
903 .RI \*(lq %nmhetcdir% \*(rq
904 is checked.
905 .PP
906 .fc ^ ~
907 .nf
908 .ta \w'%nmhetcdir%/ExtraBigFileName 'u
909 ^$HOME/\&.mh\(ruprofile~^The user profile
910 ^$MHBUILD~^Additional profile entries
911 ^%nmhetcdir%/mhn.defaults~^System default MIME profile entries
912 .fi
913 .SH "PROFILE COMPONENTS"
914 .fc ^ ~
915 .nf
916 .ta 2.4i
917 .ta \w'ExtraBigProfileName 'u
918 ^Path:~^To determine the user's nmh directory
919 ^Current\-Folder:~^To find the default current folder
920 ^mhbuild-compose-<type>*~^Template for composing contents
921 .fi
922 .SH "SEE ALSO"
923 .IR mhlist (1),
924 .IR mhshow (1),
925 .IR mhstore (1),
926 .IR fmt (1),
927 .IR iconv (1),
928 .IR par (1)
929 .PP
930 .I "Proposed Standard for Message Encapsulation"
931 (RFC 934),
932 .PP
933 .I "The Content-MD5 Header Field"
934 (RFC 1864),
935 .PP
936 .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"
937 (RFC 2045),
938 .PP
939 .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"
940 (RFC 2046),
941 .PP
942 .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text"
943 (RFC 2047),
944 .PP
945 .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures"
946 (RFC 2048),
947 .PP
948 .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples"
949 (RFC 2049),
950 .PP
951 .I "Definition of the URL MIME External-Body Access-Type"
952 (RFC 2017),
953 .PP
954 .I "MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations"
955 (RFC 2231)
956 .SH DEFAULTS
957 .nf
958 .RB ` \-headers '
959 .RB ` \-realsize '
960 .RB ` \-norfc934mode '
961 .RB ` \-contentid '
962 .RB ` \-nocheck '
963 .RB ` \-noverbose '
964 .RB ` \-nodisposition '
965 .RB ` \-autoheaderencoding '
966 .RB ` "\-maxunencoded\ 78"'
967 .fi