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