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