.\" .\" %nmhwarning% .\" .TH MHBUILD %manext1% "%nmhdate%" MH.6.8 [%nmhversion%] .SH NAME mhbuild \- translate MIME composition draft .SH SYNOPSIS .na .HP 5 .B mhbuild .I file .RB [ \-verbose " | " \-noverbose ] .RB [ \-Version ] .RB [ \-help ] .ad .SH DESCRIPTION The .B mhbuild command will translate a MIME composition draft into a valid MIME message. .PP .B mhbuild creates multi-media messages as specified in RFC\-2045 thru RFC\-2049. Currently .B mhbuild only supports encodings in message bodies, and does support the encoding of message headers as specified in RFC\-2047. .PP If you specify the name of the composition file as `-', then .B mhbuild will accept the composition draft on the standard input. If the translation of this input is successful, .B mhbuild will output the new MIME message to the standard output. This argument must be the last argument on the command line. .PP Otherwise if the file argument to .B mhbuild is the name of a valid composition file, and the translation is successful, .B mhbuild will replace the original file with the new MIME message. It will preserve the original file under the same name with `.orig' appended. E.g., if you are editing the file `draft', its original contents it will be preserved as `draft.orig'. This allows you to easily recover the .B mhbuild input file. .SS "Translating the Composition File" .B mhbuild is essentially a filter to aid in the composition of MIME messages. .B mhbuild will convert an .B mhbuild `composition file' into a valid MIME message. A .B mhbuild `composition file' is just a file containing plain text that is interspersed with various .B mhbuild directives. When this file is processed by .BR mhbuild , the various directives will be expanded to the appropriate content, and will be encoded according to the MIME standards. The resulting MIME message can then be sent by electronic mail. .PP The formal syntax for a .B mhbuild composition file is defined at the end of this document, but the ideas behind this format are not complex. Basically, the body contains one or more contents. A content consists of either a directive, indicated with a `#' as the first character of a line; or, plaintext (one or more lines of text). The continuation character, `\\`, may be used to enter a single directive on more than one line, e.g., .PP .RS 5 .nf #image/png \\ /home/foobar/junk/picture.png .fi .RE .PP There are three kinds of directives: `type', `message' (#forw), and `begin' (#begin). .PP .B "(1) The `type' directive is used to directly specify the type and subtype of a content. You may only specify discrete types in this manner (can't specify the types multipart or message with this directive). You may optionally specify the name of a file containing the contents in `native' (decoded) format. If this filename starts with the `|' character, then it represents a command to execute whose output is captured accordingly. For example, .PP .RS 5 .nf #audio/basic |raw2audio \-F < /usr/lib/sound/giggle.au .fi .RE .PP If a filename is not given, .B mhbuild will look for information in the user's profile to determine how the different contents should be composed. This is accomplished by consulting a composition string, and executing it under .BR /bin/sh , with the standard output set to the content. If the .B \-verbose switch is given, .B mhbuild will echo any commands that are used to create contents in this way. .PP The composition string may contain the following escapes: .PP .RS 5 .nf .ta \w'%P 'u %a Insert parameters from directive %f Insert filename containing content %F %f, and stdout is not re-directed %s Insert content subtype %% Insert character % .fi .RE .PP First, .B mhbuild will look for an entry of the form: .PP .RS 5 mhbuild-compose-/ .RE .PP to determine the command to use to compose the content. If this isn't found, .B mhbuild will look for an entry of the form: .PP .RS 5 mhbuild-compose- .RE .PP to determine the composition command. If this isn't found, .B mhbuild will complain. .PP An example entry might be: .PP .RS 5 mhbuild-compose-audio/basic: record | raw2audio \-F .RE .PP Because commands like these will vary, depending on the display environment used for login, composition strings for different contents should probably be put in the file specified by the .B $MHBUILD environment variable, instead of directly in your user profile. .PP .B "(2) The `message' directive (#forw) is used to specify a message or group of messages to include. You may optionally specify the name of the folder and which messages are to be forwarded. If a folder is not given, it defaults to the current folder. Similarly, if a message is not given, it defaults to the current message. The message directive is used by .BR forw . .PP For example, .PP .RS 5 .nf #forw +inbox 42 43 99 .fi .RE .PP If you include a single message, it will be included directly as a content of type `message/rfc822'. If you include more than one message, then .B mhbuild will add a content of type `multipart/digest' and include each message as a subpart of this content. .PP .B "(3) The `begin' directive is used to create a multipart content. When using the `begin' directive, you must specify at least one content between the begin and end pairs. .PP .RS 5 .nf #begin This will be a multipart with only one part. #end .fi .RE .PP If you use multiple directives in a composition draft, .B mhbuild will automatically encapsulate them inside a multipart content. Therefore the `begin' directive is only necessary if you wish to use nested multiparts, or create a multipart message containing only one part. .PP For all of these directives, the user may include a brief description of the content between the `[' character and the `]' character. This description will be copied into the `Content-Description' header when the directive is processed. .PP .RS 5 .nf #forw [important mail from Bob] +bob 1 2 3 4 5 .fi .RE .PP Similarly, a disposition string may optionally be provided between `{' and `}' characters; it will be copied into the `Content-Disposition' header when the directive is processed. If a disposition string is provided that does not contain a filename parameter, and a filename is provided in the directive, it will be added to the `Content-Disposition' header. For example, the following directive: .PP .RS 5 .nf #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt .fi .RE .PP creates these message part headers: .PP .RS 5 .nf Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: attachment; filename="summary.txt" .fi .RE .PP By default, .B mhbuild will generate a unique `Content-ID:' for each directive, corresponding to each message part; however, the user may override this by defining the ID using the `<' and `>' characters. .PP In addition to the various directives, plaintext can be present. Plaintext is gathered, until a directive is found or the draft is exhausted, and this is made to form a text content. If the plaintext must contain a `#' at the beginning of a line, simply double it, e.g., .PP .RS 5 ##when sent, this line will start with only one # .RE .PP If you want to end the plaintext prior to a directive, e.g., to have two plaintext contents adjacent, simply insert a line containing a single `#' character, e.g., .PP .RS 5 .nf this is the first content # and this is the second .fi .RE .PP Finally, if the plaintext starts with a line of the form: .PP .RS 5 Content-Description: text .RE .PP then this will be used to describe the plaintext content. You MUST follow this line with a blank line before starting your text. .PP By default, plaintext is captured as a text/plain content. You can override this by starting the plaintext with `#<' followed by a content-type specification. For example, e.g., .PP .RS 5 .nf #" ] [ "[" description "]" ] [ "{" disposition "}" ] [ filename ] EOL | "#forw" [ "<" id ">" ] [ "[" description "]" ] [ "{" disposition "}" ] [ "+"folder ] [ 0*msg ] EOL | "#begin" [ "<" id ">" ] [ "[" description "]" ] [ "{" disposition "}" ] [ "alternative" | "parallel" | something-else ] EOL 1*body "#end" EOL plaintext ::= [ "Content-Description:" description EOL EOL ] 1*line [ "#" EOL ] | "#<" type "/" subtype 0*(";" attribute "=" value) [ "(" comment ")" ] [ "[" description "]" ] [ "{" disposition "}" ] EOL 1*line [ "#" EOL ] line ::= "##" text EOL -- interpreted as "#"text EOL | text EOL .fi .RE .PP .SH FILES .fc ^ ~ .nf .ta \w'%etcdir%/ExtraBigFileName 'u ^$HOME/.mmh/profile~^The user profile ^$MHBUILD~^Additional profile entries ^%etcdir%/mhn.defaults~^System default MIME profile entries .fi .SH "PROFILE COMPONENTS" .fc ^ ~ .nf .ta 2.4i .ta \w'ExtraBigProfileName 'u ^Path:~^To determine the user's mail storage ^Current\-Folder:~^To find the default current folder ^mhbuild-compose-*~^Template for composing contents .fi .SH "SEE ALSO" mhlist(1), show(1), mhstore(1), forw(1), .br .I "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies" (RFC\-2045), .br .I "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types" (RFC\-2046), .br .I "Multipurpose Internet Mail Extensions (MIME) Part Three: Message Header Extensions for Non-ASCII Text" (RFC\-2047), .br .I "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures" (RFC\-2048), .br .I "Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples" (RFC\-2049) .SH DEFAULTS .nf .RB ` \-noverbose ' .fi .SH CONTEXT If a folder is given, it will become the current folder. The last message selected will become the current message. .SH BUGS Outlook 2002 won't display attachments that have a Content-ID header. This is a bug in Outlook 2002, not in .BR mhbuild . To workaround it, invoke \fIe mhbuild\fP manually at the Whatnow prompt and edit the draft again thereafter, removing the Content-ID headers. Then send it. There used to be a .B \-nocontentid switch to prevent Content-ID headers to be inserted, but as it was considered wrong to complicate all other MUAs instead of forcing the developers and users of broken MUAs to fix or change their software, it was removed.