Subject: mail formatter wanted

From: [email-masked] (John Allegrezza)
Date: 22 Oct 1994 21:13:12 -0400

greetings:

I am looking for a mail formatter for our UNIX mail messages. What I need
is a tool to filter our the garbage in the mail header keeping only From,
Date, Subject field and nicely formatting the mail body leaving possible
mail footer/signature un-touched. I haved looked at printmail from elm
package and the 'par' program on the net. 'printmail' almost does what
I want except it doesn't format the mail body where 'par' does nice
formatting but it didn't recognize the header and footer so it
formatted them too which is not what I what. Anybody out there has
any suggestions? You help will be appriciated.

--
[email-masked]

---

From: [email-masked] (James R. Hamilton)
Date: Wed, 26 Oct 1994 00:06:02 GMT

In article <[email-masked]>,
>any suggestions? You help will be appriciated.

    I use mhl for this.  Have a look at the mhl man page (I've appended
    the first 3 pages of it below).  Its easy to use, very flexible, and
    capable of more than you currently need.

                       --jrh

------------------------------------------------------------------------

     MHL(1)                         AIX                         MHL(1)

     NAME
          mhl - produce formatted listings of MH messages

     SYNOPSIS
          /usr/local/lib/mh/mhl [-bell] [-nobell] [-clear] [-noclear]
               [-folder +folder] [-form formfile] [-length lines]
               [-width columns] [-moreproc program] [-nomoreproc]
               [files ...] [-help]

     DESCRIPTION
          Mhl is a formatted message listing program.  It can be used
          as a replacement for more (1) (the default showproc ).  As
          with more, each of the messages specified as arguments (or
          the standard input) will be output.  If more than one mes-
          sage file is specified, the user will be prompted prior to
          each one, and a <RETURN> or <EOT> will begin the output,
          with <RETURN> clearing the screen (if appropriate), and
          <EOT> (usually CTRL-D) suppressing the screen clear.  An
          <INTERRUPT> (usually CTRL-C) will abort the current message
          output, prompting for the next message (if there is one),
          and a <QUIT> (usually CTRL-\) will terminate the program
          (without core dump).

          The `-bell' option tells mhl to ring the terminal's bell at
          the end of each page, while the `-clear' option tells mhl to
          clear the scree at the end of each page (or output a
          formfeed after each message).  Both of these switches (and
          their inverse counterparts) take effect only if the profile
          entry moreproc is defined but empty, and mhl is outputting
          to a terminal.  If the moreproc entry is defined and non-
          empty, and mhl is outputting to a terminal, then mhl will
          cause the moreproc to be placed between the terminal and mhl
          and the switches are ignored.  Furthermore, if the `-clear'
          switch is used and mhl's output is directed to a terminal,
          then mhl will consult the $TERM and $TERMCAP envariables to
          determine the user's terminal type in order to find out how
          to clear the screen.  If the `-clear' switch is used and
          mhl's output is not directed to a terminal (e.g., a pipe or
          a file), then mhl will send a formfeed after each message.

          To override the default moreproc and the profile entry, use
          the `-moreproc program' switch.  Note that mhl will never
          start a moreproc if invoked on a hardcopy terminal.

          The `-length length' and `-width width' switches set the
          screen length and width, respectively.  These default to the
          values indicated by $TERMCAP, if appropriate, otherwise they
          default to 40 and 80, respectively.

          The default format file used by mhl is called mhl.format
          (which is first searched for in the user's MH directory, and
          then sought in the /usr/local/lib/mh directory), this can be
          changed by using the `-form formatfile' switch.

          Finally, the `-folder +folder' switch sets the MH folder
          name, which is used for the messagename: field described
          below.  The envariable $mhfolder is consulted for the
          default value, which show, next, and prev initialize
          appropriately.

          Mhl operates in two phases: 1) read and parse the format
          file, and 2) process each message (file).  During phase 1,
          an internal description of the format is produced as a
          structured list.  In phase 2, this list is walked for each
          message, outputting message information under the format
          constraints from the format file.

          The mhl.format form file contains information controlling
          screen clearing, screen size, wrap-around control, tran-
          sparent text, component ordering, and component formatting.
          Also, a list of components to ignore may be specified, and a
          couple of special components are defined to provide added
          functionality.  Message output will be in the order speci-
          fied by the order in the format file.

          Each line of mhl.format has one of the formats:

               ;comment
               :cleartext
               variable[,variable...]
               component:[variable,...]

          A line beginning with a `;' is a comment, and is ignored.  A
          line beginning with a `:' is clear text, and is output
          exactly as is.  A line containing only a `:' produces a
          blank line in the output.  A line beginning with component:
          defines the format for the specified component, and finally,
          remaining lines define the global environment.

          For example, the line:

               width=80,length=40,clearscreen,overflowtext="***",overflowoffset=5

          defines the screen size to be 80 columns by 40 rows, speci-
          fies that the screen should be cleared prior to each page,
          that the overflow indentation is 5, and that overflow text
          should be flagged with ***.

          Following are all of the current variables and their argu-
          ments.  If they follow a component, they apply only to that
          component, otherwise, their affect is global.  Since the
          whole format is parsed before any output processing, the
          last global switch setting for a variable applies to the
          whole message if that variable is used in a global context
          (i.e., bell, clearscreen, width, length).

               variable       type       semantics
               width          integer    screen width or component width
               length         integer    screen length or component length
               offset         integer    positions to indent component:
               overflowtext   string     text to use at the beginning of an
                                         overflow line
               overflowoffset integer    positions to indent overflow lines
               compwidth      integer    positions to indent component text
                                         after the first line is output
               uppercase      flag       output text of this component in all
                                         upper case
               nouppercase    flag       don't uppercase
               clearscreen    flag/G     clear the screen prior to each page
               noclearscreen  flag/G     don't clearscreen
               bell           flag/G     ring the bell at the end of each page
               nobell         flag/G     don't bell
               component      string/L   name to use instead of component for
                                         this component
               nocomponent    flag       don't output component:  for this
                                         component
               center         flag       center component on line (works for
                                         one-line components only)
               nocenter       flag       don't center
               leftadjust     flag       strip off leading whitespace on each
                                         line of text
               noleftadjust   flag       don't leftadjust
               compress       flag       change newlines in text to spaces
               nocompress     flag       don't compress
               split          flag       don't combine multiple fields into a single field
               nosplit        flag       combine multiple fields into a single field
               newline        flag       print newline at end of components (default)
               nonewline      flag       don't print newline at end of components
               formatfield    string     format string for this component (see below)
               addrfield      flag       field contains addresses
               datefield      flag       field contains dates

          To specify the value of integer-valued and string-valued
          variables, follow their name with an equals-sign and the
          value.  Integer-valued variables are given decimal values,
          while string-valued variables are given arbitrary text
          bracketed by double-quotes.  If a value is suffixed by /G or
          /L, then its value is useful in a global-only or local-only
          context (respectively).

          A line of the form:

              ignores=component,...

          specifies a list of components which are never output.

          The component MessageName (case-insensitive) will output the
          actual message name (file name) preceded by the folder name
          if one is specified or found in the environment.  The format
          is identical to that produced by the `-header' option to

-- 

James R. Hamilton                              home inet: [email-masked]
Toronto, Canada                                home uucp: ...!uunet!jrh!jrh
home: +1 416 510 1059                          work inet: [email-masked]