source: trunk/third/nmh/man/mhbuild.man @ 12455

Revision 12455, 18.4 KB checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12454, which included commits to RCS files with non-trunk default branches.
Line 
1.\"
2.\" %nmhwarning%
3.\" $Id: mhbuild.man,v 1.1.1.1 1999-02-07 18:14:20 danw Exp $
4.\"
5.\" include the -mh macro file
6.so %etcdir%/tmac.h
7.\"
8.TH MHBUILD %manext1% MH.6.8 [%nmhversion%]
9.SH NAME
10mhbuild \- translate MIME composition draft
11.SH SYNOPSIS
12.in +.5i
13.ti -.5i
14mhbuild file
15.br
16\%[\-list] \%[-nolist]
17\%[\-realsize] \%[\-norealsize]
18.br
19\%[\-headers] \%[\-noheaders]
20\%[\-ebcdicsafe] \%[\-noebcdicsafe]
21.br
22\%[\-rfc934mode] \%[\-norfc934mode]
23\%[\-verbose] \%[\-noverbose]
24.br
25\%[\-check] \%[\-nocheck]
26\%[\-version]
27\%[\-help]
28.in -.5i
29.SH DESCRIPTION
30The \fImhbuild\fR command will translate a MIME composition draft into
31a valid MIME message.
32
33\fImhbuild\fR creates multi-media messages as specified in RFC\-2045
34thru RFC\-2049.  Currently \fImhbuild\fR only supports encodings in
35message bodies, and does not support the encoding of message headers as
36specified in RFC\-2047.
37
38If you specify the name of the composition file as \*(lq-\*(rq,
39then \fImhbuild\fR will accept the composition draft on the standard
40input.  If the translation of this input is successful, \fImhbuild\fR
41will output the new MIME message to the standard output.  This argument
42must be the last argument on the command line.
43
44Otherwise if the file argument to \fImhbuild\fR is the name of a valid
45composition file, and the translation is successful, \fImhbuild\fR will
46replace the original file with the new MIME message.  It will rename
47the original file to start with the \*(lq,\*(rq character and end with the
48string \*(lq.orig\*(rq, e.g., if you are editing the file \*(lqdraft\*(rq,
49it will be renamed to \*(lq,draft.orig\*(rq.  This allows you to easily
50recover the \fImhbuild\fR input file.
51
52.Uh "Listing the Contents"
53The `\-list' switch tells \fImhbuild\fR to list the table of contents
54associated with the MIME message that is created.
55
56The `\-headers' switch indicates
57that a one-line banner should be displayed above the listing.  The
58`\-realsize' switch tells \fImhbuild\fR to evaluate the \*(lqnative\*(rq
59(decoded) format of each content prior to listing.  This provides an
60accurate count at the expense of a small delay.  If the `\-verbose' switch
61is present, then the listing will show any \*(lqextra\*(rq information
62that is present in the message, such as comments in the Content-Type header.
63
64.Uh "Translating the Composition File"
65\fImhbuild\fR is essentially a filter to aid in the composition of MIME
66messages.  \fImhbuild\fR will convert an
67\fImhbuild\fR \*(lqcomposition file\*(rq
68into a valid MIME message.  A \fImhbuild\fR \*(lqcomposition file\*(rq
69is just a file containing plain text that is interspersed
70with various \fImhbuild\fR directives.  When this file is processed
71by \fImhbuild\fR, the various directives will be expanded to the
72appropriate content, and will be encoded according to the MIME standards.
73The resulting MIME message can then be sent by electronic mail.
74
75The formal syntax for a \fImhbuild\fR composition file is defined at the
76end of this document, but the ideas behind this format are not complex.
77Basically, the body contains one or more contents.  A content consists of
78either a directive, indicated with a \*(lq#\*(rq as the first character
79of a line; or, plaintext (one or more lines of text).  The continuation
80character, \*(lq\\\*(lq, may be used to enter a single directive on more
81than one line, e.g.,
82.sp
83.nf
84.in +.5i
85#image/png \\
86    /home/foobar/junk/picture.png
87.in -.5i
88.fi
89.sp
90There are four kinds of directives: \*(lqtype\*(rq directives, which
91name the type and subtype of the content; \*(lqexternal-type\*(rq
92directives, which also name the type and subtype of the content; the
93\*(lqmessage\*(rq directive (#forw), which is used to forward one or
94more messages; and, the \*(lqbegin\*(rq directive (#begin), which is
95used to create a multipart content.
96
97The \*(lqtype\*(rq directive is used to directly specify the type and
98subtype of a content.  You may only specify discrete types in this manner
99(can't specify the types multipart or message with this directive).
100You may optionally specify the name of a file containing the contents
101in \*(lqnative\*(rq (decoded) format.  If this filename starts with the
102\*(lq|\*(rq character, then it represents a command to execute whose
103output is captured accordingly.
104For example,
105.sp
106.nf
107.in +.5i
108#audio/basic |raw2audio -F < /usr/lib/sound/giggle.au
109.in -.5i
110.fi
111.sp
112If a filename is not given, \fImhbuild\fR will look for information in the
113user's profile to determine how the different contents should be composed.
114This is accomplished by consulting a composition string, and executing
115it under \fB/bin/sh\fR, with the standard output set to the content.
116If the `\-verbose' switch is given, \fImhbuild\fR will echo any commands
117that are used to create contents in this way.
118.ne 13
119The composition string may contain the following escapes:
120.sp
121.nf
122.in +.5i
123.ta \w'%P  'u
124%a      Insert parameters from directive
125%f      Insert filename containing content
126%F      %f, and stdout is not re-directed
127%s      Insert content subtype
128%%      Insert character %
129.re
130.in -.5i
131.fi
132.sp
133
134First,
135\fImhbuild\fR will look for an entry of the form:
136.sp
137.in +.5i
138mhbuild-compose-<type>/<subtype>
139.in -.5i
140.sp
141to determine the command to use to compose the content.  If this isn't
142found, \fImhbuild\fR will look for an entry of the form:
143.sp
144.in +.5i
145mhbuild-compose-<type>
146.in -.5i
147.sp
148to determine the composition command.
149
150If this isn't found, \fImhbuild\fR
151will complain.
152
153An example entry might be:
154.sp
155.in +.5i
156mhbuild-compose-audio/basic: record | raw2audio -F
157.in -.5i
158.sp
159Because commands like these will vary, depending on the display
160environment used for login, composition strings for different
161contents should probably be put in the file specified by the
162\fB$MHBUILD\fR environment variable, instead of directly in your
163user profile.
164
165The \*(lqexternal-type\*(rq directives are used to provide a MIME
166reference to a content, rather than enclosing the contents itself
167(for instance, by specifying an ftp site).  Hence, instead of
168providing a filename as with the type directives, external-parameters
169are supplied.  These look like regular parameters, so they must be
170separated accordingly.  For example,
171.sp
172.nf
173.in +.5i
174#@application/octet-stream; \\
175    type=tar; \\
176    conversions=compress \\
177    [this is the nmh distribution] \\
178    name="nmh.tar.gz"; \\
179    directory="/pub/nmh"; \\
180    site="ftp.math.gatech.edu"; \\
181    access-type=anon-ftp; \\
182    mode="image"
183.in -.5i
184.fi
185.sp
186You must give a description string to separate the content parameters
187from the external-parameters (although this string may be empty).
188This description string is specified by enclosing it within
189\*(lq[]\*(rq.
190.ne 19
191These parameters are of the form:
192.sp
193.nf
194.in +.5i
195.ta \w'access-type=  'u
196access-type=    usually \fIanon-ftp\fR or \fImail-server\fR
197name=   filename
198permission=     read-only or read-write
199site=   hostname
200directory=      directoryname (optional)
201mode=   usually \fIascii\fR or \fIimage\fR (optional)
202size=   number of octets
203server= mailbox
204subject=        subject to send
205body=   command to send for retrieval
206.re
207.in -.5i
208.fi
209.sp
210
211The \*(lqmessage\*(rq directive (#forw) is used to specify a message or
212group of messages to include.  You may optionally specify the name of
213the folder and which messages are to be forwarded.  If a folder is not
214given, it defaults to the current folder.  Similarly, if a message is not
215given, it defaults to the current message.  Hence, the message directive
216is similar to the \fIforw\fR\0(1) command, except that the former uses
217the MIME rules for encapsulation rather than those specified in RFC\-934.
218For example,
219.sp
220.nf
221.in +.5i
222#forw +inbox 42 43 99
223.in -.5i
224.fi
225.sp
226If you include a single message, it will be included directly as a content
227of type \*(lqmessage/rfc822\*(rq.  If you include more than one message,
228then \fImhbuild\fR will add a content of type \*(lqmultipart/digest\*(rq
229and include each message as a subpart of this content.
230
231If you are using this directive to include more than one message, you
232may use the `\-rfc934mode' switch.  This switch will indicate that
233\fImhbuild\fR should attempt to utilize the MIME encapsulation rules
234in such a way that the \*(lqmultipart/digest\*(rq that is created
235is (mostly) compatible with the encapsulation specified in RFC\-934.
236If given, then RFC\-934 compliant user-agents should be able to burst the
237message on reception\0--\0providing that the messages being encapsulated
238do not contain encapsulated messages themselves.  The drawback of this
239approach is that the encapsulations are generated by placing an extra
240newline at the end of the body of each message.
241
242The \*(lqbegin\*(rq directive is used to create a multipart content.
243When using the \*(lqbegin\*(rq directive, you must specify at least one
244content between the begin and end pairs.
245.sp
246.nf
247.in +.5i
248#begin
249This will be a multipart with only one part.
250#end
251.in -.5i
252.fi
253.sp
254If you use multiple directives in a composition draft, \fImhbuild\fR will
255automatically encapsulate them inside a multipart content.  Therefore the
256\*(lqbegin\*(rq directive is only necessary if you wish to use nested
257multiparts, or create a multipart message containing only one part.
258
259For all of these directives, the user may include a brief description
260of the content between the \*(lq[\*(rq character and the \*(lq]\*(rq
261character.  This description will be copied into the
262\*(lqContent-Description\*(rq header when the directive is processed.
263.sp
264.nf
265.in +.5i
266#forw [important mail from Bob] +bob 1 2 3 4 5
267.in -.5i
268.fi
269.sp
270By default, \fImhbuild\fR will generate a unique \*(lqContent-ID:\*(rq for
271each directive; however, the user may override this by defining the ID
272using the \*(lq<\*(rq and \*(lq>\*(rq characters.
273
274In addition to the various directives, plaintext can be present.
275Plaintext is gathered, until a directive is found or the draft is
276exhausted, and this is made to form a text content.  If the plaintext
277must contain a \*(lq#\*(rq at the beginning of a line, simply double it,
278.ne 6
279e.g.,
280.sp
281.in +.5i
282##when sent, this line will start with only one #
283.in -.5i
284.sp
285If you want to end the plaintext prior to a directive, e.g., to have two
286plaintext contents adjacent, simply insert a line containing a single
287\*(lq#\*(rq character,
288.ne 10
289e.g.,
290.sp
291.nf
292.in +.5i
293this is the first content
294#
295and this is the second
296.in -.5i
297.fi
298.sp
299Finally,
300if the plaintext starts with a line of the form:
301.sp
302.in +.5i
303Content-Description: text
304.in -.5i
305.sp
306then this will be used to describe the plaintext content.
307You MUST follow this line with a blank line before starting
308your text.
309
310By default, plaintext is captured as a text/plain content.  You can
311override this by starting the plaintext with \*(lq#<\*(rq followed by
312a content-type specification.  For example,
313.ne 11
314e.g.,
315.sp
316.nf
317.in +.5i
318#<text/enriched
319this content will be tagged as text/enriched
320#
321and this content will be tagged as text/plain
322#
323#<application/x-patch [this is a patch]
324and this content will be tagged as application/x-patch
325.in -.5i
326.fi
327.sp
328Note that if you use the \*(lq#<\*(rq plaintext-form, then the
329content-description must be on the same line which identifies the content
330type of the plaintext.
331
332When composing a text content, you may indicate the relevant character
333set by adding the \*(lqcharset\*(rq parameter to the directive.
334.sp
335.in +.5i
336#<text/plain; charset=iso-8859-5
337.in -.5i
338.sp
339If a text content contains any 8bit characters (characters with the
340high bit set) and the character set is not specified as above, then
341\fImhbuild\fR will assume the character set is of the type given by the
342environment variable MM_CHARSET.  If this environment variable is not
343set, then the character set will be labeled as \*(lqx-unknown\*(rq.
344
345If a text content contains only 7bit characters and the character set
346is not specified as above, then the character set will be labeled as
347\*(lqus-ascii\*(rq
348
349Putting this all together,
350.ne 15
351here is an example of a more complicated message draft.  The
352following draft will expand into a multipart/mixed message
353containing five parts:
354.sp
355.nf
356.in +.5i
357To: nobody@nowhere.org
358cc:
359Subject: Look and listen to me!
360--------
361The first part will be text/plain
362#<text/enriched
363The second part will be text/enriched
364#
365This third part will be text/plain
366#audio/basic [silly giggle]  \\
367    |raw2audio -F < /usr/lib/sounds/giggle.au
368#image/gif   [photo of foobar] \\
369                    /home/foobar/lib/picture.gif
370.in -.5i
371.fi
372.sp
373.Uh "Integrity Check"
374If \fImhbuild\fR is given the `-check' switch, then it will also associate
375an integrity check with each \*(lqleaf\*(rq content.  This will add a
376Content-MD5 header field to the content, along with the md5 sum of the
377unencoded contents.  This may be used by the receiver of the message to
378verify that the contents of the message were not changed in transport.
379
380.Uh "Transfer Encodings"
381After \fImhbuild\fR constructs the new MIME message by parsing directives,
382including files, etc., it scans the contents of the message to determine
383which transfer encoding to use.  It will check for 8bit data, long lines,
384spaces at the end of lines, and clashes with multipart boundaries.  It will
385then choose a transfer encoding appropriate for each content type.
386
387If an integrity check is being associated with each content by using
388the `\-check' switch, then \fImhbuild\fR will encode each content with
389a transfer encoding, even it the content contains only 7bit data.  This
390is to increase the likelihood that the content is not changed while in
391transport.
392
393The switch `\-ebcdicsafe' will cause \fImhbuild\fR to slightly change
394the way in which it performs the \*(lqquoted-printable\*(rq transfer
395encoding.  Along with encoding 8bit characters, it will now also encode
396certain common punctuation characters as well.  This slightly reduces the
397readability of the message, but allows the message to pass more reliably
398through mail gateways which involve the EBCDIC character encoding.
399
400.Uh "Invoking mhbuild"
401Typically, \fImhbuild\fR is invoked by the \fIwhatnow\fR program.  This
402command will expect the body of the draft to be formatted as an
403\fImhbuild\fR composition file.  Once you have composed this input file
404using a command such as \fIcomp\fR, \fIrepl\fR, or \fIforw\fR, you invoke
405\fImhbuild\fR at the \*(lqWhat now\*(rq prompt with
406.sp
407.in +.5i
408What now? mime
409.in -.5i
410.sp
411prior to sending the draft.  This will cause \fIwhatnow\fR to execute
412\fImhbuild\fR to translate the composition file into MIME format.
413
414It is also possible to have the \fIwhatnow\fR program invoke \fImhbuild\fR
415automatically when a message is sent.  To do this, you must add the line
416.sp
417.in +.5i
418automimeproc: 1
419.in -.5i
420.sp
421to your \&.mh\(ruprofile file.
422
423Finally, you should consider adding this line to your profile:
424.sp
425.in +.5i
426lproc: show
427.in -.5i
428.sp
429This way, if you decide to \fBlist\fR after invoking \fImime\fR,
430the command
431.sp
432.in +.5i
433What now? list
434.in -.5i
435.sp
436will work as you expect.
437
438.Uh "User Environment"
439Because the environment in which \fImhbuild\fR operates may vary for a
440user, \fImhbuild\fR will look for the environment variable \fB$MHBUILD\fR.
441If present, this specifies the name of an additional user profile which
442should be read.  Hence, when a user logs in on a particular machine,
443this environment variable should be set to refer to a file containing
444definitions useful for that machine.
445
446Finally, \fImhbuild\fR will attempt to consult a global \fImhbuild\fR
447user profile,
448.ne 6
449e.g.,
450.sp
451.in +.5i
452%etcdir%/mhn.defaults
453.in -.5i
454.sp
455if it exists.
456
457.Uh "Syntax of Composition Files"
458.ne 59
459The following is the formal syntax of a \fImhbuild\fR
460\*(lqcomposition file\*(rq.
461.sp
462.nf
463.in +.5i
464   body         ::=     1*(content | EOL)
465
466   content      ::=     directive | plaintext
467
468   directive    ::=     "#" type "/" subtype
469                            0*(";" attribute "=" value)
470                            [ "(" comment ")" ]
471                            [ "<" id ">" ]
472                            [ "[" description "]" ]
473                            [ filename ]
474                            EOL
475
476                      | "#@" type "/" subtype
477                            0*(";" attribute "=" value)
478                            [ "(" comment ")" ]
479                            [ "<" id ">" ]
480                            [ "[" description "]" ]
481                            external-parameters
482                            EOL
483
484                      | "#forw"
485                            [ "<" id ">" ]
486                            [ "[" description "]" ]
487                            [ "+"folder ] [ 0*msg ]
488                            EOL
489
490                      | "#begin"
491                              [ "<" id ">" ]
492                              [ "[" description "]" ]
493                              [   "alternative"
494                                | "parallel"
495                                | something-else    ]
496                              EOL
497                            1*body
498                        "#end" EOL
499
500   plaintext    ::=     [ "Content-Description:"
501                              description EOL EOL ]
502                            1*line
503                        [ "#" EOL ]
504
505                      | "#<" type "/" subtype
506                            0*(";" attribute "=" value)
507                            [ "(" comment ")" ]
508                            [ "[" description "]" ]
509                            EOL
510                            1*line
511                        [ "#" EOL ]
512
513   line         ::=     "##" text EOL
514                        -- interpreted as "#"text EOL
515                      | text EOL
516.in -.5i
517.fi
518.sp
519.Fi
520^$HOME/\&.mh\(ruprofile~^The user profile
521^$MHBUILD~^Additional profile entries
522^%etcdir%/mhn.defaults~^System default MIME profile entries
523.Pr
524^Path:~^To determine the user's nmh directory
525.Ps
526^Current\-Folder:~^To find the default current folder
527.Ps
528^mhbuild-compose-<type>*~^Template for composing contents
529.Sa
530mhlist(1), mhshow(1), mhstore(1)
531.br
532RFC\-934:
533.br
534   \fIProposed Standard for Message Encapsulation\fR,
535.br
536RFC\-2045:
537.br
538   \fIMultipurpose Internet Mail Extensions (MIME) Part One:
539.br
540   Format of Internet Message Bodies\fR,
541.br
542RFC\-2046:
543.br
544   \fIMultipurpose Internet Mail Extensions (MIME) Part Two:
545.br
546   Media Types\fR,
547.br
548RFC\-2047:
549.br
550   \fIMultipurpose Internet Mail Extensions (MIME) Part Three:
551.br
552   Message Header Extensions for Non-ASCII Text\fR,
553.br
554RFC\-2048:
555.br
556   \fIMultipurpose Internet Mail Extensions (MIME) Part Four:
557.br
558   Registration Procedures\fR,
559.br
560RFC\-2049:
561.br
562   \fIMultipurpose Internet Mail Extensions (MIME) Part Five:
563.br
564   Conformance Criteria and Examples\fR.
565.De
566`\-headers'
567.Ds
568`\-realsize'
569.Ds
570`\-norfc934mode'
571.Ds
572`\-nocheck'
573.Ds
574`\-noebcdicsafe'
575.Ds
576`\-noverbose'
577.Co
578If a folder is given, it will become the current folder.  The last
579message selected will become the current message.
580.En
Note: See TracBrowser for help on using the repository browser.