[Previous] [Up] [Next]
Go backward to Using Electronic Mail
Go up to Top
Go forward to Network Mail: Mail Between U.C.B. and the Outside World

Using MH

Introduction to MH

This section is a brief introduction to mh, the "mail handler," another electronic mail system. Although mh is an electronic mail system, mh is not a program. Rather, it is a set of commands like scan and send for manipulating electronic mail messages.

For a list of the most important commands, see the mh command summary table.

Brief Tutorial

Electronic Mail Messages

When users want to communicate with each other using an electronic mail system, they send electronic mail messages. Electronic mail messages are just like letters, documents, and memos, but you transmit them electronically using the computer rather than a piece of paper. A typical electronic mail message looks like this:

Received: by po-1.berkeley.edu
      id AA29055; Mon, 16 Jul 90 11:27:40 CDT
Received: by berkeley.edu with sendmail-5.57/4.7
      id <AA04432@berkeley.edu>; Mon, 16 Jul 90 11:27:48 CDT
From: user@berkeley.edu
Message-Id: <9007161627.AA04432@berkeley.edu>
To: person@berkeley.edu
cc: friend@berkeley.edu
Subject: Cancellation of meeting!
Date: Mon, 16 Jul 90 11:27:46 CDT
 
There will NOT be an operations meeting today at 9:30.
 
BUT PLAN FOR ONE ON THE 19TH --
SAME TIME, SAME STATION.

Reading Your Mail

If you discover that you have new mail and you want to read it, you must first "incorporate" it from the post office to your personal incoming mailbox. To incorporate  or pick up your mail, enter:

% inc
The first time you use inc, you may be asked the question:
Your MH-directory /home/.../username/Mail doesn't exist; Create it?
where username is your username and Mail is a directory used as your mh inbox.  You should enter y to create your inbox.

Your messages will then be placed in your inbox and you will be provided with a listing that contains the sequence number, date, author, and subject of all messages that have arrived since the last time you entered inc. If the subject of a message is short, the listing displays the first part of the body of the message after the characters <<. Here is a typical listing:

18+     6/11   user@berkeley.edu        Cancellation of meeting!! <<T
19      6/11   person@berkeley.edu      Reschedule It... <<please if
20      6/12   friend@berkeley.edu      I'm busy on Thursday << so how
Once you have incorporated your mail, you are ready to actually read your messages. To do this, simply enter the command: 
% show
This will clear your screen, then display the first message sent to you. This message will look something like the example message presented earlier in this tutorial. Even if you have received more than one piece of mail, entering show will only display the first message that you have received. To display the other messages you can use one of two methods. The first method is to enter:
% show nn
where nn is the sequence number of the message found in the listing when you incorporated your mail. The second, and easier, way to display the rest of your messages is to enter:
% next 
This will display the next piece of mail you have received, or the next sequence number in your message listing. Just keep entering next after reading each piece of mail until you have displayed all the mail you have just received.

To go back and reread one of the previous messages that you just displayed, simply enter:

% prev 
Like the command next, you can keep entering prev until you get to the message you want to see again.

Listing Your Mail

If you wish to see a brief listing of all the mail you have received but not deleted, enter:

% scan 
and a listing similar to the one inc provides will appear, except that it includes all the mail you have in your inbox.

If you have more than one page of scan listing, you may wish to pipe the scan command through the more command. Enter:

% scan | more
to obtain one screenful at a time. Press the <spacebar> to view the next screenful.

You can specify a range of sequence numbers to any of the mh commands by entering the command with the first sequence number, a hyphen, then the last sequence number. For example, enter:

% scan 1-3
if you want a scan list of messages with sequence numbers 1 to 3.

If for some reason you don't remember the exact sequence numbers of the messages you want to scan, but you have an idea of when you received them, you can scan small groups of your messages at the beginning or end of your listing by entering scan followed by either first: or last: followed by the number of messages you want to scan. For example, entering:

% scan last:3
would give you a listing of the last three messages you have received.

Replying to Mail

To reply to a message you have received, enter repl  followed by the sequence number of the message to which you want to reply:

% repl 18
If you just enter repl, i.e., repl without a sequence number, repl will reply to the currently selected message. When you reply to a message, repl will call the your default editor.

The mh commands, like repl, that call an editor may take a few moments to start. When you enter the editor, you will see a screen with a message header template; repl supplies a message header template that contains preconstructed To: and Subject: fields. For the sample message given above, repl would produce the following template:

H
E         To:  (Random H User) <user@berkeley.edu>
A         Subject: Re: Cancellation of meeting !!
D         In-reply-to: Your message of Mon, 16 Jul 90 11:27:46 -0500.
E                      <9007161627.AA04432@berkeley.edu>
R         ---------
 
B         You
0           place
D               message-text
Y                          here
At this point, you can edit any of the header fields you like. Then enter in the body of the reply after the line of dashes. Do not delete the dashed line; mh needs it.

Note that repl automatically sends the message to the person you are replying to, but it doesn't send it to everyone who received the original message. If you want to send a copy of your reply to everyone, use the repl command like this:

% repl -cc all
Here repl automatically copies the message to you and to the other people who received the original message. Quite often, you may want to delete some of the addressees in the cc: field first.

When you've finished entering the message, just save the file and exit the editor as your normally would.

The editor will store the message you have just created in a file called ~/Mail/draft. Then, you will see: What now? To send your reply message, enter:

What now? send 
or just the letter s and press <Return>. Your message has been sent when your machine prompt reappears on your screen. See below for other commands which can be used at the What now? prompt. 

Composing and Sending Mail

To send mail to another user, you must first "compose" the message using comp. If you enter:

% comp 
you will find yourself in your default editor   with a message header template that looks like this:
H
E       To:
A       cc:
D       Subject:
E       -------
R
 
B        You
0          place
D              message-text
Y                         here
Fill in the To: field with the username of the recipient of the message. If you want to send the message to more than one person, separate their usernames with commas.

Then, add the usernames of people you wish to send copies in the cc: field. Fill in a subject for the Subject: field (optional). Finally, enter the text of your message below the dashed line.

Next, just as you did with repl, exit the editor as you would normally. When you see What now?, enter s and your message will be sent (as shown in Replying to Mail).

Forwarding Mail

You can forward mail you have received by entering: 

% forw sequence-number
If you enter forw without a sequence number, forw will forward the currently selected message.

The forw command is just like comp, except that forw adds the message you wish to forward to the end of the default message template, surrounding it with the following two lines:

------- Forwarded Message
 
------- End of Forwarded Message
You can add any additional notes you wish simply by entering them beneath the dashed line that indicates the end of the forwarded message.

Deleting Mail

Unless a particular mail message is very important to you, it is a good idea to delete mail accumulating in your inbox on a regular basis. It saves storage space that may be used to store more important files in the future. You also may exceed your storage quota (which may lead to lost messages) if you don't periodically remove mail. To remove a mail message, enter: 

% rmm sequence-number
If you enter rmm without a sequence number, rmm will delete the currently selected message.

Filing and Rearranging Mail

The mh system has an arrangement of "folders" that allows you to store the messages you want to save. You can think of these folders as the electronic counterpart of the file folders you put in a desk. Folders are stored as subdirectories under the ~/Mail directory. The inbox  is the only folder you have when you start using mh, but you can easily create other folders to organize your mail more efficiently.

Creating Folders and Refiling Mail

To create a new folder or to move a message in an existing folder to another folder, enter:  
% refile sequence-number +foldername
Note that the sequence-number is the number of the message in the current folder and the foldername is the name of the destination folder. If you enter refile without a sequence-number argument, refile will refile the currently selected message.

You can use any combination of alphanumeric characters (A--Z, a--z, 0--9), dot (.) and hyphen (-) for a foldername; non-alphanumeric characters may cause problems. If the destination folder does not already exist, refile will inquire:

Create folder /home/username/Mail/foldername?
If the foldername is the one you want, enter y; if incorrect, enter n and try again.

Once again, note that refile removes the specified message from the current folder when you move it to the destination folder. (Read the refile man page for information.) You can refile a message to more than one foldername like this:

% refile sequence-number +fl +f2 ... +fn

Moving Around Folders

The folder command identifies the current folder. Enter:
% folder 
You will see something like:
inbox+ has 20 messages; ( 1-20); cur=15
You start out in the folder called inbox,  the folder that inc  uses to incorporate your mail.

If you want to move to another folder, enter:

% folder +foldername
 

Listing Folders

If you want a list of all the folders you've made, enter:
% folders 
A + appears next to the current folder. The folders command is equivalent to:
% folder -all
When you delete messages using rmm,  be sure that you are in the right folder, or you may inadvertently delete some important mail.

Compacting or "Packing" Folders

If you want to renumber the messages in a folder starting with 1 so that the folder has the lowest sequence numbers possible, you can "pack" the folder by entering:
% folder -pack +foldername 
If the current folder had contained messages with sequence numbers 1, 15, and 19 before using the -pack command, it would contain the same messages afterward, but with the sequence numbers 1, 2, and 3.

Subfolders

Another useful mh feature is subfolders. If you have created a folder, you can create subfolders in that folder, just as if you created a directory and a subdirectory in that directory. For instance, enter:

% refile sequence-number +foldername/subfoldername
  where sequence-number is the number of a message in the current folder and foldername is the name of the folder under which you wish to create the subfolder.

To list the names of subfolders under a given folder, enter:

% folders +foldername

Removing Folders

You can remove folders and subfolders with the rmf command. This function removes messages first and then the folder itself. If a folder contains subfolders or files that are not part of mh, rmf produces an error message.  

The syntax of the command is:

% rmf + folderspec
where folderspec may be either a foldername or a subfolder specification. For example, to remove the folder named myfolder enter the command:
% rmf +myfolder
To remove a subfolder named inbox/mysubfolder enter the command:
% rmf +inbox/mysubfolder

Another Way To Send Mail

For a "quick and dirty" method to send mail, enter:

% comp -editor prompter
Respond appropriately to the prompts for each of the header fields, enter in the body of your message under the dashed line, and enter <ctrl>-D to store the message draft. Continue as with comp or repl when you see:
What now?

The What now? Prompt

When you compose a message and exit the editor, you receive the question What now? A number of options are available. If you enter a question mark ?, a listing of response commands is displayed. These commands include:

display
Display message you are replying to.  
edit
Go to the default editor (see below)  
headers
Display draft's headers.  
list
Display the draft.  
push
Send message and immediately exit to the shell.  
quit
Quit.  
repl
Delete message draft.  
refile
Refile draft in designated folder.  
send
Send the message.  
whom
List receivers.  
Simply enter the desired response and press <Return>. For example, to send your message enter send or just the letter s. If you exited the editor prematurely and want to enter some additional information, you can do so with the edit command.

The send command  occurs not only as an option to mh commands, like repl and send, but as a command on its own. If you have a message draft in ~/Mail/draft that you composed previously, you can send the message by entering:

% send draft
Similarly, you can send any file in the ~/Mail directory as long as it has a message header template.

Changing the Default Editor

If you prefer to use another editor, you can modify the file named .mh_profile that contains your mh setup profile. If you want to use emacs, for example, change the line labeled Editor: so it contains the path to the emacs command. Place the name emacs on the Prompter-next line. When you are done, these two lines should read:

Editor: /usr/local/emacs
Prompter-next: emacs
Type which emacs to find the path for emacs to use above. It will probably be one of the following: /usr/local/emacs, /usr/local/bin/emacs, /share/a/bin/emacs, or /usr/sww/bin/emacs. Once you have made these changes, mh will use emacs instead of vi. With this exception, the mh commands will function as described in the earlier sections of this chapter.

Sending a File With mail

The mh facility does not enable you to conveniently mail a file to a correspondent. However, you can do this with a single mail command. For example, if you want to send a file named myfile.txt to a correspondent with the username of cim enter the command:
% mail cim@host.EECS.berkeley.edu < myfile.tex

Online Help and Documentation

Two online help features aid users with the mh mail system and associated commands. If you add the -help option to any command, it will give a brief description of the usage of that command, rather than executing it. For example, enter:

% scan -help
to get a brief description of the scan command.

The man command provides more complete descriptions of mh and related commands. Try entering:

% man scan
The table below summarizes the important mh commands.

Xmh -- an X Windows Interface to mh

If you are at a local workstation (as opposed to being logged in remotely or at a terminal) you may want to try the command xmh. This command presents an X Windows interface to mh. There are pull-down menus which contain all the commands discussed earlier in this chapter. To invoke a command, you pull down the appropriate menu and click on the command.

The xmh interface invokes the commands discussed in this chapter from within this X Windows interface.

To learn more about xmh enter the command:

% man xmh 
 

Commands Brief Description
comp Compose a message. dist Redistribute a message. folder Select/list status of folders. folders Lists folders/subfolders (same as: folder -all). forw Forward a message to another user. inc Incorporate new mail. next Show the next message. pick Select a set of messages by context. prev Show the previous message. refile Move messages between folders. repl Reply to a message. rmf Remove a folder. rmm Remove a message. scan Produce an abbreviated listing of selected messages, including sender and subject. send Send a previously composed message. show Show messages. Options Brief Description
-help Print help info on preceding command. mh_profile Change default message format. mh_suppress Filter out excess header information. -pack Consolidate messages in folder. prompter Quick message composition.

sharon@eecs.berkeley.edu
janp@eecs.berkeley.edu
April 11, 1995

[Previous] [Up] [Next]