The content of this document may be incorrect or outdated.
Print this article Edit this article
Mail Handler (MH): Using MH
To access mh, you should have the following path set in your shell start-up file:
/usr/local/bin/mhThe Unix Programmer's Manual is kept on the system. It is possible to get the documentation for any command by using the man command. For example, to get a write-up for the
comp command, at your system prompt you would type the following:
....................................write-up for the comp command %% man comp
Introduction
Electronic mail (e-mail) is a quick, convenient way to send a message to another person (or persons). The message recipient can read and reply to the message at his convenience. Communication via electronic messages is commonplace.This paper describes a message handling system called MH. MH is a collection of small single-purpose programs used to manipulate mail messages which are kept in individual files. This system provides you with tools to compose, send, receive, store, retrieve, forward, and reply to messages.
The first time you use the "mhmail" command, MH will create a directory called Mail in your home
directory. All
your mail will be stored in directories beneath this one. It will also create a file in your home directory called .mh_profile. The .mh_profile allows you to tailor your MH environment.
Using electronic mail
An electronic mail message consists of two parts: the headers and the body. The body comes after the headers and consists of the "messages"; whatever the sender typed in. The header is the lines at the top of the message including the subject and addresses of the people to whom the message is addressed. It is similar to the top lines of a memo (i.e., To:, From:, Subject: and so on). The headers are separated from the body by a blank line.
An electronic mail address looks like: name@host. The name is a person's mail handle (which is their login name assigned). The host is the system where the addressee receives mail. Within the ECN domain, you need only know the person's mail handle and the mail system will automatically fill in the host part.
Reading Mail
show
To read the current message, type show. To read a specific message, give that message number as an argument. If the message is longer than one screenful, you will see the word "more" at the bottom of the screen. When you are ready to see more of the message, press the SPACE bar to see another screenful or press the return key to see just one more line.
Example 1
% show 4
(Message inbox:51)
Received: from america.ecn.purdue.edu (root@america.ecn.purdue.edu [128.46.154.151])
by harbor.ecn.purdue.edu (8.6.9/3.5davy) with ESMTP
id PAA05246; Tue, 31 Jan 1995 15:28:52 -0500
Received: from localhost (cathyc@localhost [127.0.0.1])
by america.ecn.purdue.edu (8.6.9/3.5davy) with ESMTP
id PAA08377; Tue, 31 Jan 1995 15:28:49 -0500
Message-Id: <199501312028.PAA08377@america.ecn.purdue.edu>
To: Davy Crockett <dcrocket@ecn.purdue.edu>
Cc:
Subject: Re: Pingo
In-reply-to: Message from Patrick O'Brien "Tue, 31 Jan 1995 15:27:43 -0500"
Date: Tue, 31 Jan 1995 15:28:46 EST
From: Patrick O'Brien <obrien@ecn.purdue.edu>
>>Can you please provide me with a copy of Pingo?
>
> Davy Crockett
Davy,
I have found a copy of the tutorial "Pingo". Look in the System Cabinet > Editing-Cabinet >Graphics Folder > Samples Drawer.
Patrick
- next
- The next command shows the message after the current one. It is equivalent to show next.
- prev
- The prev command shows the message before the current one. This command is equivalent to show prev.
- rmm
- The
rmmcommand removes the current message. It may be called with message numbers as arguments to delete specific messages.
Example 2
rmm will remove the current message.
rmm 3 will remove message 3.
Selecting Messages
Messages can be referred to by their message numbers. Some MH commands, such as show, can act upon more than one message at a time. A range of messages can be specified using the form n-mwhere n and m are message numbers, or one of the reserved message names described below can be used:
cur The current message (the last one that was handled)If you do not name a specific message, the commands will act on the current message.
next The next message
prev The previous message
first The first message in the folder
last The last message in the folder
all All messages (first-last)
Printing Messages
Using the show command and piping it through to the lp command, you can print your mail messages. The printer name must be preceded by a -d. To print message 4 to printer msa type:
If you have a default printer variable set in your shell start up file, then all you need to type is:% show 4 | lp -d msa
inc and scanshow 4 | lp
When someone sends a mail message to you, it is delivered in a file called your "mailbox". Every time you log into your UNIX account, you will be told if you have new mail messages.When you are ready to read these messages, you must incorporate them using the inc command. This will move your mail into your inbox and generate a listing of the senders and subjects of the new messages.
When you get the message "You have mail" at your prompt, type the command inc (incorporate). MH will display a "scan listing" which shows you the messages you received since the last inc command.
Example 3The
% inc
Incorporating new mail into inbox..
4+ 09/29 dcrocket Pingo<<I have found a copy of the tutor
5 09/30 jrloser picnic reminder<<everyone, this is jus
inc command copies your mail into your inbox folder, assigns a unique number to each message, and then produces a scan listing. The numbers allow you to refer to each message individually. After the message number, you see the date the message was sent, the name of the sender and the subject of the message.
To look at your entire inbox folder you would type the command scan:
Example 4The
% scan
1 09/05 dcrocket Pingo<<Can you please provide me with a
2- 09/12 obrien scan list<<I would like to see a newsle
3 09/15 mhawkin library books due<<everyone; please ch
4+ 09/29 dcrocket Pingo<<I have found a copy of the tutor
5 09/30 jrloser picnic reminder<<everyone, this is jus
scan command produces a one-line-per-message listing of the specified messages. Each scan line contains the message number (name), the date, the "From:" field, and the "Subject:" field, and, if room allows, some of the body of the message.
The plus sign (+) next to a message number indicates it is the current message. The minus sign (-) next to a message number indicates a reply has been sent to the specified message. If there is sufficient room left on the scan line after the subject, the line will be filled with text from the body, preceded by <<, and terminated by >> if the body is sufficiently short. Scan actually reads each of the specified messages and extracts the desired fields.
The refile command moves a mail message to another folder. If the folder you requested does not exist, MH will ask you if you would like to create this folder. The arguments to refile are the message number(s), and folder name preceded by a plus sign (+). The current message is used if message numbers are not given.
Example 5The message number 3 will be moved from the current folder to the accounting folder.
% refile 3 +accounting
To copy a mail message from your inbox to another folder (the message will remain in your inbox AND be copied to the specified folder), you must use the link option to the refile command.
Example 6
% refile 3 -link +accounting
Replying to Messages
To reply to the current message typerepl. To reply to a specific message, type repl n where n specifies the message number. repl uses a reply template which contains the following elements:
To:When you do this, the reply headers will be printed out and you will be put in your default editor. When you are replying to a message, the name of the sender of the original message will appear in the "To:" field. Any other people on the "To:" or "Cc:" lists will also be copied on your reply message.
cc:
Subject: Re:
In-reply-to:
Forwarding Messages
Theforw command will forward a message(s). The forw command is used to prepare a message containing other messages. It constructs the new message from the components file, with a body composed of the message(s) to be forwarded. You will be prompted to fill in the headers (the address to which the message is to be forwarded, etc..). When you have done this, you will see the text of the message which you are forwarding and will be given the opportunity to add text to the message. Exit the editor and type send at the "What now?" prompt.
Folders
Folders are used for storing mail messages in an organized fashion. In all of the MH commands, a plus sign preceding an argument indicates a folder name. Thus "+inbox" is the name of your standard inbox. If an explicit folder argument is given to an MH command, it will become the current folder. If the folder does not exist yet, you will be asked if it should be created. To access messages in another folder, you can change your current folder from "inbox" to something else. For example, if you want to look at all the messages pertaining to accounting, you would type:Example 7The folder accounting will then become your current folder and then you can use
% folder +accounting or
% scan +accounting
scan, show, etc., to manipulate the messages in this folder. To change back to the "inbox", type:
Example 8Using the
% folder +inbox
inc command will change your current folder to "inbox" if new mail is incorporated. The command folders will display a list of all your folders and the number of messages in each.
To have your messages appear in sequential order, with no gaps in the sequence, you can pack your folder. The folder -pack command will consolidate the messages in your current folder into a a consecutive sequence.
Example 9Now if you removed messages 3 and 4 and did a
% scan
1 09/05 dcrocket Pingo<<Can you please provide me with a
2- 09/12 obrien scan list<<I would like to see a newsle
3 09/15 mhawkin library books due<<everyone; please ch
4+ 09/29 dcrocket Pingo<<I have found a copy of the tutor
5 09/30 jrloser picnic reminder<<everyone, this is jus
scan, then executed the command folder -pack, your inbox would look like the following:
% scanIf a printer name is not specified, the message will be printed to your default printer. For example:
1 09/05 dcrocket Pingo<<Can you please provide me with a
2- 09/12 obrien scan list<<I would like to see a newsle
3 09/30 jrloser picnic reminder<<everyone, this is ju
% show 4 | lpThe above example will print your mail messages with a header page. A header page is a title page with information such as the printer name, the user name (and real life name of the user), host name, date, etc... a header page is printed out with each document submitted to the printer, unless otherwise specified. Printing header pages is a wise idea for printers which accomodate many users. Jobs can become easily confused with the absence of the header page identifying the owner of the job.
To print several messages in a continuous format (i.e., zero page breaks), you would use the following command:
show 1-20 | lpTo print several messages including page breaks (one message per page, not in continuous format), you would use the following command:
show 1-20 -show pr | lpThis will separate the messages to include page breaks and will produce one header page for all the messages.
To send output to a printer other than the default printer which is specified in your shell start up file, use the lp command with the -d option to the printer name:
show 1-20 -show pr | lp -d msa
Composing and Sending a Message
To create a message, use thecomp command. This puts you in your default editor (the editor you chose when you first logged in). The comp template will appear and prompt you to fill in the headers. The template contains the following elements:
To:You should type the requested information for the headers, then enter your message. The information entered in the "To:" header should be the name(s) of the person(s) you want this message to be sent to (name@site or just name), the "Cc:" header should be the name (s) of the person(s) you want a copy of this message to be sent to, and the "Subject" header should be the subject of this message. You then exit the editor as you normally would. Upon exiting the editor, comp will invoke a program which will ask you "What now?". Type a carriage return to see the options or type
Cc:
Subject:
-------
send or s to send the message.
Typing quit without saving the message will cause an exit from comp, with the draft message saved in a folder called drafts. You can resume editing the message later with comp -use draft# or you can send the message later, using the send command. Typing quit -delete or quit -d will exit from comp and will NOT save the message you were composing.
When asked "What now?", you can also call upon another editor of your choice to edit the draft of the message. If an editor is not specified, you will get your default editor.
Example 10This will put you in the vi editor to edit the message. When you have finished editing, just exit the editor as you would normally. You will then get another "What now?" prompt. Here are some of the "What now" options.
% What now? edit vi
edit editor Edit the message using the specified editor, or the default
editor if an editor is not specified.
list Shows the message you just typed.
whom -check Verifies that the addresses you have used are valid as far as
our system can tell.
send Sends the message to the recipients.
push Send the message in the background
quit Quits without sending the message (saves the text of the
message as a draft. Typecomp -use
draft# to get back to that draft later.
quit -delete Quit, throwing away the draft.
Mailing Files
Mailing files is not usually a good idea, especially for large files. The mail system was not designed for moving big files. You can use the copy,rcp or ftp commands to move the file to another account more efficiently.
Searching for Messages
Thepick command allows you to search your inbox (or any other) folder to find messages which contain a certain word. If you want to list all messages from the user "Jones" you can type:
Example 11This lists the numbers of all messages from Jones that are in the current folder. You can pick messages according to any of the headers ("To:", "From:", etc.) or just search all the messages for a given word.
% pick -from jones
5
12
21
%
Example 12This lists the numbers of all messages which contain the word mail in their subject lines.
% pick -subject mail
13
14
33
%
The .mh Profile
The file.mh_profile in your home directory contains a list of user-specified default options for MH programs. The only required entry is the name of your MH directory:
Path: Mail orTo make a change to your
Path: mhbox
.mh_profile, edit the file and add a line for the applicable program. For example, if you would like to use vi instead of emacs as your initial editor when composing messages, you would add this line to your .mh_profile:
Example 13Example of a
Editor: vi
.mh_profile:
Path: Mail
Editor: emacs
Draft-folder: +drafts
repl: -annotate -inplace -filter mhl.repl -cc all -nocc me
Almost all of the MH programs have options that can be set using the .mh_profile.
Aliases
Using MH, you may specify your own private mail aliases. This feature allows you to store lists of addresses or long internet addresses of people with whom you frequently correspond in one file, and then to address them using short mnemonic names. Typically, you will call your alias file aliases or .mh_alias. It must be stored in your MH directory (~/Mail directory). The format of this file is simple. The alias is given, followed by a colon, followed by one or more legal mail addresses separated by commas. In Example 14, roses is the mail alias for all the users in the department named "Rose". John Q. Public is aliased as johnq to his internet address.
Example 14Now, messages addressed to roses will be distributed to all the people listed in the alias.
% cat Mail/.aliases
roses: prose, srose, mrose, drose
johnq: johnq@csl.sri.com
In addition to your aliases file, you will need to modify your .mh_profile in order to use aliases. You should add the flag "-alias aliases" to the entries for the command ali, whom, and send creating entries for these programs if they aren't already in your .mh_profile.
MH (MAIL HANDLER) COMMANDS
The following is a list of all the MH commands. See the manual pages for details of each command. To access the on-line manual pages, type: man command.ali list mail aliases
anno annotate messages
burst explode digests into messages
comp compose a message
dist redistribute a message to additional addresses
folder set/list current folder/message
folder -pack reorganize messages in consecutive sequence
folders list all folders
forw forward messages
inc incorporate messages
mark mark messages
mhl produce formatted listings of MH messages
mhmail send or read mail
mhpath print full pathnames of MH messages and folders
msgchk check for messages
msh MH shell
next show the next message
packf compress a folder into a single file
pick select messages by content
prev show the previous message
prompter prompting editor front end
refile file messages in other folders
repl reply to a message
rmf remove folder
rmm remove messages
scan produce a one line per message scan listing
send send a message
show show (list) messages
vmh visual front-end to MH
whatnow prompting front-end for send
whom report to whom a message would go
mh-alias alias file for MH message system
mh-format format file for MH message system
mh-mail message format for MH message system
mh-profile user customization for MH message system
Last Modified:
Dec 19, 2016 11:12 am US/Eastern
Created:
May 22, 2007 12:25 pm GMT-4
by
admin
JumpURL: