MH/exmh

There are many mail systems available on UNIX machines including Mail/mail (Berkeley/AT&T mail), MH(message handling system), xmh (X-window based version of MH) and exmh (built with Tcl/Tk but runs on X-windows). We recommend using MH for line mode use and exmh for graphical usage. There is an excellent reference book "MH and xmh - Email for Users & Programmers " by Jerry Peek. We will provide here some simple and useful commands and information to get you started.

MH

MH is a very rich and flexible E-mail environment. You use MH from a UNIX shell prompt. Each command is a separate program and the shell is used as an interpreter. This is possible because MH commands are not part of a monolithic Mail system. So, all the features of UNIX shells (pipes, re-direction of I/O etc.) work with MH. Each of the MH mail folders are directories and each mail message is a file in these directories. One can therefore, use all UNIX file manipulation utilities on the messages.

Basic MH Commands

inc                        Incorporate new message(s) from the system mailbox
                           into your account (inbox folder).  You cannot read 
                           messages until you incorporate them.  Setting up 
                           automatic incorporating of messages is explained in
                           the next section.

inc -fi file               Incorporate from file, not from system mailbox

show                       Display the current message or first message incorporated.

show n                     Display message n.

next                       Display the next message

prev                       Go back to the previous message

comp                       Compose a message on the screen or using the editor 
                           defined in .mh_profile.  Type "send" at "What Now?"
                           prompt to send the message.

comp -e editor             Compose a message using your favourite editor 
                           (override.mh_profile).

send file                  Send file to the destinations in To:, cc:, Bcc:, Fcc:. 

repl                       Reply to the current message.

forw                       Forward the current message.  The prompter will ask 
                           for recipient's address and subject.  If a default 
                           editor is defined in .mh_profile, that editor is invoked.

rmm                        Delete the current message.
                           It actually hides the message from MH by renaming the
                           message file with a leading comma(,) or a hash(#) or
                           some other character.  A system program comes along
                           later and actually removes the "removed" message.
                           So, you can recover the "removed" message in the
                           interim period. 

refile +folder             Move the current message to the specified folder.

scan +folder               Display message headers from the specified folder.

scan last:n                Display the last n message header from the current folder.

scan f:n                   Display n message headers starting from message f.   

pick options               Select messages by content, date, sender, recipient, etc.

pick -help                 Display a list of pick options.

rmf +folder                Delete the specified folder.

Automatically incorporating your Mail

You can have your mail delivered to your newmail folder inbox from the system mail box by setting up a .forward file (in your home directory) with the following content.

"|/usr/local/bin/mh/fMHNewMail your_directory_path"

Then your mail is automatically incorporated for you.

Configuring your mail

Your personal configuration for MH, xmh and exmh is defined via .mh_profile file. When you first use an MH command, if a .mh_profile is not found in your directory, a simple .mh_profile is created for you. .mh_profile resides in your home directory. Following is an example of a .mh_profile file:

Path: Mail                      Directory for your MH transactions.
Unseen-Sequence: unseen         Name of the unseen sequence of messages.
Draft-folder: drafts            Name of the default folder for drafted mail.
Editor: emacs                   Sets up emacs as editor for comp/repl/forw/dist.
Aliasfile:mh_alias		File containing MH aliases (distribution lists).
Signature:John Peoples          Your signature. Appears in From: header field.
rmf: -interactive               To make sure that rmf always asks you
                                for confirmation with folder name.

Customizing your message headers

Each mail composition command such as comp, repl, forw uses its own template file. If you don't have these files in your Mail directory the system default files in the MH library section will be used. The comp uses components file, repl command uses replcomps and forw uses forwcomps. These files are briefly described here.

Sending mail to a distribution list

You can send mail to many people by defining an MH alias for addresses of the recipients. MH aliases are defined in the alias file specified in your .mh_profile.
Example alias file:

cdheads: butler@fnal.gov,\
         nicholls@fnal.gov,\
         gaines@fnal.gov

d0spokes: mont@fnal.gov,\
          pgrannis@fnal.gov

cdfspokes: carithers@fnal.gov,\
           bellettini@fnal.gov

There should not be any blanks after the \ in the aliases.  To see your aliases
you can use the command ali.  For example if you type ali d0spokes, 
you will get the reply: mont@fnal.gov, pgrannis@fnal.gov.

Automatically forwarding your mail

Store your forwarding address in the file .forward located in your home directory.
For example,
\bhat@fnal.gov

Notification of new mail

To get notification on arrival of new mail during the session you can either use "xbiff" or set up notification on your window. To do the former, you run the"xbiff" utility in one of your windows (on the system where your mail is forwarded to). It opens up a mail-box icon which gets highlighted along with mail-box flag going up when new mail arrives. To have interactive notification on your terminal window, you can include the following line in your .forward file:

\your_address,"|/usr/local/products/mh/current/lib/rcvtty -biff"

The first part forwards mail and the second part displays a line on your terminal window when new mail arrives. You have to turn on the execute permission on any window you need notification by typing

chmod u+x `tty`

If you include this in your .login then you would have notification on all windows.

Using MH commands with standard UNIX commands

Print a mail message:

% show n | flpr -q queue

Extract a message into a file:

% show n > file

Filter message headers:

% scan +inbox | grep -i pattern

Finding messages with pick:

You can find messages sent from someone, sent to someone, on a given date, 
before or after a date and even search every line of every message in the 
current folder. You can do for example,

% pick -from hefisk -sequence picked

This stores a list of message numbers from user HEFISK in the sequence "picked" and 
tells you how many messages are picked.

You can then scan these messages by typing,

%scan picked

You can search for a string by typing,

% pick -subject 'discovery of the Higgs' -sequence higgs


exmh

The exmh interface also runs under the X-window system and looks very much like xmh. It is built with Tcl/Tk instead of the X Toolkit. exmh can read and send MIME (Multipurpose Internet Mail Extensions) multimedia mail.

If you have set up exmh (%setup exmh) and your display screen (setenv $DISPLAY "nodename.fnal.gov:n.0"), you can invoke exmh by simply typing exmh. exmh uses the same configuration files as MH. The exmh has three parts to its window. The top part has the folder buttons. The middle part has message headers from the current/selected folder.The bottom part displays the current message. The current folder button will be highlighted. The name and the number of messages in the current folder will be displayed. The header of the current message will have a '+' next to its number and will also be highlighted. The title bars in each of the three parts of the screen will have command or pull-down menu buttons.

In exmh various actions are performed by clicking on the buttons and/or choosing from menu items.

Composing and sending your message

To compose your message click on the send button in the message part of the screen. Then a new drafts window will pop up to enable you to write your message. Note that the exmh does not use the editor you specify in the.mh_profile file. It uses sedit as the default editor. The drafts window will have the following contents:
To:
cc:
Subject:
Mime-Version: m.n
Content-Type:text/plain
------
Other fields will show up if you have included them in your components file. Fill in the information needed and type in the body of your message. Once you are ready with the message, you can send it to the recipient(s) by clicking on the send button. If you decide not to send it, you can either save it in the ~Mail/drafts folder by clicking on save&Quit or discard the composition by choosing Abort. There are many useful options available on the drafts window under More... such as Insert File and Spell. Under Text... you have some options for fonts.

Receiving and reading your message

When you have unread new mail messages, you will be notified when you log in. If new mail arrives during the session you will get notified eventually. You can set up other modes of notification such as xbiff or notification on your terminal window (see section on "Notification" earlier). When new mail arrives, it would be in the system mail spooling area until you incorporate it into your mail folder, unless you have set up automatic incorporating. To receive your message, use inc button from the middle set of buttons. The current message is displayed in the bottom portion of the exmh window. You can display any message by clicking on the message header displayed in the middle portion of the window with the left mouse button. To view messages in another folder (other than the current) click the left mouse button on the appropriate folder button. Then the message headers from that folder are displayed. You can then read the messages from this folder as before.

Replying to mail

You can select the message you want to reply to and have it displayed on the message window. Then click on the Reply button in the message window.You get a menu of options to choose from. Once you have made the selection, a composition window will pop up. The header fields will all be filled up. You can edit the header if needed. Move the cursor to the body area and type in your reply. Then click on the send button to send the reply. To skip the reply click on the Abort.

Searching for messages

To search messages in a folder you should first select the folder (click on the button with the name of the folder). Then click on search... and select the relevant option. You can get help on various items by looking into search help . If you choose Find in table of contents, for example, you get a Find Tool window where you can type in the pattern (and hit Return). The headers of the selected messages are highlighted. You can then display the headers of the selected messages by choosing List only selected messages from More... menu. The Pick by attribute from the Search... menu provides an interface to the MH Pick command. You can set up complex logical search expressions and save the sequence of the picked messages using this tool.

Forwarding messages

To send a copy of a message to some one, select the message as before. (You can select more than one message to forward, at a time.) Then, select Forward from the message part of the window. A composition window with headers will come up. Fill in the header. Send or abort as explained before. The Forward uses either forwcomps (or the format file specified in the .mh_profile file) for the header.

Removing messages

If you want to delete some messages then you can first mark them for deletion by selecting them and clicking on Delete from the message area. The messages you want to delete will get highlighted in the table of contents (list of message headers). If you are sure that you want to delete the marked messages click on Commit button in the header area. If you change your mind before you commit, select the messages you do not want to delete and Unmark them from the more... menu form the message area buttons.

Forwarding mail from VMS machines

To forward the mail you receive on VMS machines to your UNIX machine, invoke mail on the VMS machine and set your forwarding address as follows:

Mail> set forw "SMTP%""your_name@your_unix_node.fnal.gov"""

Links to other D0 pages

  • D0 UNIX Page
  • D0 home Page

  • Last update: May 27, 1997
    P. Bhat