Provided by: mmh_0.4-2_amd64 bug


       mhbuild - translate MIME composition draft


       mhbuild file [-verbose | -noverbose] [-Version] [-help]


       The mhbuild command will translate a MIME composition draft into a valid MIME message.

       mhbuild  creates  multi-media  messages as specified in RFC-2045 thru RFC-2049.  Currently
       mhbuild only supports encodings in message  bodies,  and  does  support  the  encoding  of
       message headers as specified in RFC-2047.

       If  you  specify  the  name  of  the composition file as `-', then mhbuild will accept the
       composition draft on the standard input.  If the translation of this input is  successful,
       mhbuild  will  output  the new MIME message to the standard output.  This argument must be
       the last argument on the command line.

       Otherwise if the file argument to mhbuild is the name of a valid composition file, and the
       translation  is  successful,  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 mhbuild input file.

   Translating the Composition File
       mhbuild is essentially a filter to aid in the composition of MIME messages.  mhbuild  will
       convert  an  mhbuild `composition file' into a valid MIME message.  A mhbuild `composition
       file' is just a file containing plain text  that  is  interspersed  with  various  mhbuild
       directives.   When  this  file  is  processed  by  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.

       The  formal  syntax for a 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.,

            #image/png \

       There are three kinds of directives: `type', `message' (#forw), and `begin' (#begin).

       (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,

            #audio/basic |raw2audio -F < /usr/lib/sound/

       If a filename is not given, 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 /bin/sh, with the standard  output
       set  to the content.  If the -verbose switch is given, mhbuild will echo any commands that
       are used to create contents in this way.

       The composition string may contain the following escapes:

            %a  Insert parameters from directive
            %f  Insert filename containing content
            %F  %f, and stdout is not re-directed
            %s  Insert content subtype
            %%  Insert character %

       First, mhbuild will look for an entry of the form:


       to determine the command to use to compose the content.  If this isn't found, mhbuild will
       look for an entry of the form:


       to determine the composition command. If this isn't found, mhbuild will complain.

       An example entry might be:

            mhbuild-compose-audio/basic: record | raw2audio -F

       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 $MHBUILD environment variable, instead of directly in your user profile.

       (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 forw.

       For example,

            #forw +inbox 42 43 99

       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 mhbuild will add  a  content
       of type `multipart/digest' and include each message as a subpart of this content.

       (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.

            This will be a multipart with only one part.

       If you use  multiple  directives  in  a  composition  draft,  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.

       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.

            #forw [important mail from Bob] +bob 1 2 3 4 5

       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:

            #text/plain; charset=iso-8859-1 <>{attachment} /tmp/summary.txt

       creates these message part headers:

            Content-Type: text/plain; charset="iso-8859-1"
            Content-Disposition: attachment; filename="summary.txt"

       By default, 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.

       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.,

            ##when sent, this line will start with only one #

       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.,

            this is the first content
            and this is the second

       Finally, if the plaintext starts with a line of the form:

            Content-Description: text

       then  this will be used to describe the plaintext content.  You MUST follow this line with
       a blank line before starting your text.

       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,

            this content will be tagged as text/enriched
            and this content will be tagged as text/plain
            #<application/x-patch [this is a patch]
            and this content will be tagged as application/x-patch

       Note that if you use the `#<' plaintext-form, then the content-description must be on  the
       same line which identifies the content type of the plaintext.

       When  composing  a text content, you may indicate the relevant character set by adding the
       `charset' parameter to the directive.

            #<text/plain; charset=iso-8859-5

       If a text content contains any 8-bit characters (characters with the high bit set) and the
       character  set is not specified as above, then mhbuild will assume the character set is of
       the type given by the environment variable MM_CHARSET.  If this  environment  variable  is
       not set, then the character set will be labeled as `x-unknown'.

       If a text content contains only 7-bit characters and the character set is not specified as
       above, then the character set will be labeled as `us-ascii'.

       Putting this all together, here is an example of a more complicated  message  draft.   The
       following draft will expand into a multipart/mixed message containing five parts:

            Subject: Look and listen to me!
            The first part will be text/plain
            The second part will be text/enriched
            This third part will be text/plain
            #audio/basic [silly giggle]  \
                |raw2audio -F < /usr/lib/sounds/
            #image/gif   [photo of foobar] \

   Transfer Encodings
       After  mhbuild  constructs  the  new  MIME message by parsing directives, including files,
       etc., it scans the contents of the message to determine which transfer  encoding  to  use.
       It  will  check  for  8bit  data, long lines, spaces at the end of lines, and clashes with
       multipart boundaries.  It will then  choose  a  transfer  encoding  appropriate  for  each
       content type.

   Invoking mhbuild
       Typically,  mhbuild  is  invoked  by  the send program.  It expects an mhbuild composition
       file, which send will create, from the draft file, if MIME features are  requested.   This
       is the case with attachment headers.

       In  contrast  to previous versions, the user does not need to care for any special actions

   User Environment
       Because the environment in which mhbuild operates may vary for a user, mhbuild  will  look
       for  the  environment  variable  $MHBUILD.   If  present,  this  specifies  the name of an
       additional user profile which should be read.  Hence, when a user logs in on a  particular
       machine, this environment variable should be set to refer to a file containing definitions
       useful for that machine.

       Finally, mhbuild will attempt to consult a global mhbuild user profile, e.g.,


       if it exists.

   Syntax of Composition Files
       The following is the formal syntax of a mhbuild `composition file'.

            body         ::=     1*(content | EOL)

            content      ::=     directive | plaintext

            directive    ::=     "#" type "/" subtype
                                     0*(";" attribute "=" value)
                                     [ "(" comment ")" ]
                                     [ "<" id ">" ]
                                     [ "[" description "]" ]
                                     [ "{" disposition "}" ]
                                     [ filename ]

                               | "#forw"
                                     [ "<" id ">" ]
                                     [ "[" description "]" ]
                                     [ "{" disposition "}" ]
                                     [ "+"folder ] [ 0*msg ]

                               | "#begin"
                                       [ "<" id ">" ]
                                       [ "[" description "]" ]
                                       [ "{" disposition "}" ]
                                       [   "alternative"
                                         | "parallel"
                                         | something-else    ]
                                 "#end" EOL

            plaintext    ::=     [ "Content-Description:"
                                       description EOL EOL ]
                                 [ "#" EOL ]

                               | "#<" type "/" subtype
                                     0*(";" attribute "=" value)
                                     [ "(" comment ")" ]
                                     [ "[" description "]" ]
                                     [ "{" disposition "}" ]
                                 [ "#" EOL ]

            line         ::=     "##" text EOL
                                 -- interpreted as "#"text EOL
                               | text EOL


       $HOME/.mmh/profile         The user profile
       $MHBUILD                   Additional profile entries
       /etc/mmh/mhn.defaults      System default MIME profile entries


       Path:                To determine the user's mail storage
       Current-Folder:      To find the default current folder
       mhbuild-compose-<type>Template for composing contents


       mhlist(1), show(1), mhstore(1), forw(1),
       Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet  Message  Bodies
       Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types (RFC-2046),
       Multipurpose  Internet  Mail  Extensions  (MIME) Part Three: Message Header Extensions for
       Non-ASCII Text (RFC-2047),
       Multipurpose  Internet  Mail  Extensions  (MIME)  Part   Four:   Registration   Procedures
       Multipurpose  Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples




       If a folder is given, it will become the current folder.  The last message  selected  will
       become the current message.


       Outlook  2002  won't  display attachments that have a Content-ID header.  This is a bug in
       Outlook 2002, not in mhbuild.  To workaround it, invoke e mhbuild manually at the  Whatnow
       prompt  and  edit  the draft again thereafter, removing the Content-ID headers.  Then send
       it.  There used to be a -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.