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