[Next] [Previous] [Up] [Top] [Contents] [Index]
Chapter 12: UNIX Mail Systems
In this section we provide a guide to the basic commands and operations in both exmh and mh. Be aware that many more features and functions are available in these products than you'll find documented here.
We want to remind you that both mh and exmh are highly configurable interfaces to the powerful MH system. You can customize your personal setup to your heart's content, however we emphasize that neither mh nor exmh requires tweaking and tailoring beyond a very manageable minimal amount. We provide you with the information necessary to set up these interfaces for effective use in three places:
Recall that exmh and mh use the same underlying commands, although they have very different user interfaces. We've organized this section by function, showing you how to perform each selected function in both exmh and mh. This should make it easier to switch back and forth between the two interfaces if you sometimes find yourself at a graphics-capable terminal, and sometimes at an ASCII-only terminal.
We recommend that you perform couple of initial steps before starting to practice. These steps relate to mail forwarding, and we recommend them at this stage because of the way incoming mail is stored under UNIX (mail storage is discussed in section 12.4.3).
where |
If you have an account on another machine, why don't you send a message or two to yourself on your chosen mail node before getting started so you have some messages to read? This isn't necessary, you can always send messages to yourself on your mail node.
% setup exmh
The use of exmh requires that you set your DISPLAY environment variable appropriately (see section 9.2).
When you setup exmh, you also setup several other products[58] which exmh either needs or with which it can interface. Among these is mh. If you've never run setup mh
, then the first time you run setup exmh
the file .mh_profile
is created in your $HOME
directory, and a message is sent to you (ignore the content of this message; it may be out of date). The .mh_profile
file defines your basic MH configuration.
To invoke exmh, enter:
% exmh [&]
The first time you invoke exmh, you are asked if you want to create a message folder for message drafts in your Mail
subdirectory. If you respond Yes, it adds a line to your .mh_profile
identifying the folder.[59] By default the folder is called drafts
, but you are given the opportunity to name it as you wish.
[Missing image]
Click on Yes if you wish to continue.
Now an exmh window appears. The exmh window is split into three areas, which we also call windows. The title bars in each of the three windows have command or pull-down menu buttons. Actions are performed by clicking on the buttons and/or choosing from menu items.[Missing image]
The three windows have different functions:
displays one "button" for every defined message folder. The current folder button is highlighted. Select a folder (make it current) by clicking on it with the left mouse button. MH message folders are discussed in section 12.4.2.
displays message headers in the current folder (the folder selected in the top box). The title bar for this area displays the current folder name and the number of messages. The header of the current message has a '+' next to its number and is highlighted.
displays the current message (the message highlighted in the middle box). The title bar for this area displays the current folder name and the current message number.
A general usage note: You can display any message by clicking the message header in the middle window with the left mouse button to make it the current message. To select multiple headers (useful for refiling, removing, etc. several messages at a time), hold down the shift key while you press the left mouse button to select each one.
You may find that on your terminal the default font size for exmh is rather small. If you really want to change it, here's how. You'll need to include two lines at the top of your The The font specifications from which you can choose may be platform-specific. Execute the command We suggest the following font specifications, if they are available on your system. Just add these two lines to your
|
To setup mh, enter:
% setup mh
You don't need to do this if you've already setup exmh.
The first time you do this, it creates a file .mh_profile
in your $HOME
directory. It also automatically sends a message to you (ignore the content of this message; it may be out of date).
Now all the mh commands are available for use. As mentioned earlier, there is no single invoking command; you simply type mh commands at the shell prompt as you need them.
Remember to send yourself a message or two so you'll have something to read later on.
For both exmh and mh, a default message header with the following contents is provided for sending messages:
|
If you wish to change the contents or appearance of the message header, you can create your own components
file. See section F.2 for information.
To compose your message click on send in the bottom window. The word comp (for compose) will appear in the command menu bar. Then a new drafts window will pop up in which you will write your message. exmh uses sedit (Simple Editor) as the default editor for composing messages. As a new user, you may just want to use this editor for a while to simplify your initial setup.[Missing image]
Fill in the information, using a tab between the header fields[61], and then type in the body of your message below the dashes. On many terminals <Ctrl-h> is used for character deletion. Alternately, you can select the text to delete and press your Backspace or Delete key[62]. Most mail programs expect a carriage return at the end of each line of the message, so it is always wise to include it.
Note that if you set your preferences (go to Preferences button in top window) for Simple Editor to Format Mail Default On, you don't need to explicitly include the carriage return at the end of each line, it will be done automatically for you after you exit the editor. This feature is only available for the sedit editor.[63] Once you finish in the "Simple Editor Preferences" window, click Dismiss. Then click Save on the "Exmh Preferences" window.
Once you have completed 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, which only are useful if the destination machine/mail reader supports them. If not, the recipient will see things like <bold>{your message text}</bold>
in the message.
If you don't want to use this editor, you can define a different default editor, or you can define a secondary editor and then select it from the More menu in the compose window (this secondary editor option is only available with sedit as primary editor).
To define a different default editor, select Editor Support under the Preferences menu option in the top window. A pop-up window will appear. If your preferred editor "knows how to" create its own X window, e.g., emacs, nedit, enter in the Editor Command field:
where editor is the editor of your choice. If your preferred editor does not have this capability, e.g. vi, you'll need to enter:
where Your selected editor must be in your PATH; you cannot use an alias definition instead. Click on Dismiss when you're done, and then be sure you click on Save in the "Exmh Preferences" menu. |
To send a message in which you want to include a file, compose the message, and use the "include file" command appropriate for the editor you're using.
When you save the composed message you are presented with a "What Now?" dialog box (a feature of MH) that gives you options to Send, Re-edit, Dismiss (this "dismisses" the pop-up window and leaves the message in the drafts folder), or Kill the message.[Missing image]
mh will throw you into vi by default for composing a message. This is also true for forwarding and replying to messages. You can specify a different editor on the command line if you like.
To compose a message in vi, enter:
% comp
This brings up a vi session. Compose your message. Then save the message file, and exit the editor.
Remember to have the handy list of vi "survival commands" from section 11.3.1 with you! Just in case you get stuck, here's your emergency exit: hit the Escape key (or <Ctrl-[>) and then enter:
:x
to save and exit, or
:q!
to quit without saving
Once you exit the editor, MH's What Now? program is automatically invoked to prompt you for an action. At the What Now?
prompt, you can enter a carriage return to get a list of options. Normally you will enter one of these options:
send
to send the message
quit
to save the message in Mail/drafts
but not send it
quit -delete
to quit and not save.
To compose a message in a different editor, enter:
% comp -e editor
This brings up a session in your selected editor. This option will override any editor defaults. Compose your message. Then save the file, exit the editor, and respond to What Now?
If you really want to avoid vi at all costs, we'll show you how to set a different default editor.
To change your default editor for mh, add the following line to your where |
If you want to send a text file rather than a message, use the mhmail
command. Here is an example to illustrate the syntax (more options are available, see the man page):
% mhmail joe@fnal -cc sue@fnal -subject "Here's the file!" < \ filename
To send a message in which you want to include a file, compose the message, and use the "include file" command appropriate for the editor you're using. In vi enter:
:r filename
In emacs, use [Ctrl-x] followed by i
, then type in the filename at the prompt.
Mail incorporation refers to the process of moving incoming mail messages from the default mail holding area on your UNIX node into your personal area. Section 12.4.3 discusses this in more detail. You can't read messages until you incorporate them. As messages get incorporated according to MH default standards, they go to the directory $HOME/Mail/inbox
(inbox
is called a folder), which was created for you during setup. Each message becomes a separate, numbered file in inbox
. When you incorporate messages, you get all the messages in the spool; you cannot choose to incorporate some and not others.
There are a few ways to incorporate mail during an exmh session. You can incorporate your messages manually, or set options to incorporate mail either immediately upon invoking exmh, and/or periodically during your mail session.
To incorporate messages manually from within exmh, click inc from the middle window's menu. By default your spooled mail is placed in your inbox
folder. You should now see the headers of the messages you sent yourself in the middle window. (If you didn't already send yourself some mail, go back and do it now.)
Once you incorporate your message(s), you can display any message by clicking the message header in the middle window with the left mouse button to make it the current message. The message displays in the bottom window.
To set up immediate or periodic incorporation during your exmh session, see section 12.4.3.
First, incorporate the new message(s) into the MH system using the command:
% inc
This will display the headers of the incorporated messages, with a plus sign (+
) next to the current message. The current message is the first unread one, usually the first one you just incorporated unless you had unread messages already in the folder. (If you didn't already send yourself some mail, go back and do it now.)
After incorporating, you can use scan
to display the message header(s):
% scan
Display message headers from the current folder (since we haven't created any other folders, the current one is inbox
).
% scan last:n
Display the last n message headers from the current folder.
% scan m-n
Display message headers m through n, inclusive, from the current folder.
Here's our first example of using mh commands together with standard UNIX commands. To select message headers in inbox
according to a pattern, you could pipe scan
to grep
in this way (the +inbox
specifically requests the inbox
folder, and the -i
option of grep
indicates a case-insensitive search for pattern):
% scan +inbox | grep -i pattern
To read the current message, enter:
% show [n]
Display the current (or specified) message.
Note that the show
command can be used with more than one message number. For example show n
can be expanded to show m n ...
or to show m-n
.
Other commands to read messages are:
The default reply header looks like this:
|
If you don't like the standard reply header, you can reformat it by creating your own replcomps
file. See section F.2 for information.
When you want to include the original message in your reply, it is often convenient to precede each line of the original message text by a >
symbol, to distinguish it from your text. FUE sets this up automatically for exmh and mh.
This formatting can be inconvenient if the recipient needs to work with the original text, and thus needs to remove all the >
's. You can avoid this by forwarding the message back to the original sender, instead of replying. Forwarding is covered in section 12.3.5.
If you want to change the format of your replies, you can create a file called .mh_filter
in your $HOME
directory. The O'Reilly MH book describes the different possible ways of setting this up. The contents of the default .mh_filter
is:
body:component="> ",compwidth=0
Select the message to which you want to reply so that it displays in the message (bottom) window. Then click on the Reply button in the bottom window. You get a menu of options. Reply to sender sends it just to the sender, while Reply all sends it to everyone listed in To:
and Cc:
. To include the original message in the reply, choose one of the Reply menu options with /include.
Once you have made a selection from the Reply menu options, a composition window pops up. The header fields will be filled in. You can edit the header if needed. Move the cursor to the body area and type in your reply.
For sedit, click on the send button to send the reply. To skip the reply, click on Abort.
For other editors, save the message and exit the editor. Then respond to the "What Now?" pop-up menu.
By default, the repl
command uses the vi editor. To avoid this, either use the -e editor
option or set a different default editor in your .mh_profile
.
To reply to a message, enter:
% repl [n]
Reply to the current (or specified) message. By default, everyone who got the original message gets a copy (the sender, plus everyone in To:
and cc:
).
% repl_inc [n]
Like repl
, but include the original message. (This FUE command replaces the standard mh command repl -filter filter_file
.)
Either of these opens an editing session for the reply. As with comp
, save your message and respond to the What Now?
prompt.
The -query
option used with either of these commands prompts about each recipient separately. To reply to selected addresses in the To:
and cc:
fields of the original message, enter:
% repl -query
Reply to the current message. You will be prompted for each address in turn, to which you reply y
or n
, for example:
Reply to user1@FNAL.GOV? y
Reply to user2@xxx.yyy? n
Use the -nocc headerfield
option with either command to prevent all addresses in a particular header field from receiving the reply; for example:
% repl -nocc cc [n]
Reply to the current (or specified) message, including all addresses except those in the original cc
list.
By default, forwarding uses a header file called forwcomps
in the MH library directory. This file is similar to that used for the compose function (components
). If you want your header for forwarding messages to be identical to that for sending messages, you can use the components file for both. Just include the following line in your .mh_profile
file:
forw: -form components
If you want to customize the header for forwarding mail, you need to set up your own file called forwcomps
in your $HOME/Mail
directory. Edit it in the same manner as components
(see section F.2).
To forward a copy of a message to someone, first select the message. You can select more than one message at a time. Then select Forward from the bottom window. A composition window comes up with a blank header and the message text. Fill in the header, and edit the message if you wish. Send or abort as explained earlier, according to your editor.
By default, the forw
command uses the vi editor. To avoid this, either use the -e editor
option or set a different default editor in your .mh_profile
.
% forw [n]
Forward the current message (or the specified message).
This opens an edit session. Fill in the header, and edit the message as you like. As with comp
and repl
, save your message and respond to the What Now?
prompt.
First set your print queue by selecting Printing under Preferences in the top window. It should look like the following, with your own print queue substituted:[Missing image]
Click Dismiss when you've completed the change on the "Printing Preferences" window, then click Save on the "Exmh Preferences" window.
To print the current message, use the Print option from the More... menu in the bottom window.
To print several messages from a single folder, select them in the middle window, and use the Print option from the More... menu in the bottom window.
To print a mail message, you use an mh display command piped to a UNIX print command (normally flpr
under FUE). Any printing defaults you've set up for printing files will be used here (printing is covered in Chapter 8).
To print message number n on queue, enter:
% show n | flpr -q queue
The option -showproc
with the mhl
argument formats the message a little differently so that it's easier to read (and nicer for printing), and pipes it to more. You would type:
% show -showproc mhl n | flpr -q queue
Especially good for printing multiple messages is the argument pr
which separates mail messages onto successive pages:
% show -showproc pr m n ... | flpr -q queue
In MH format, each message is already a separate file, and can be manipulated as any other file. You may find however, that extracting messages is easier or quicker than standard UNIX file manipulation for some tasks.
To extract the current message to a file, use the Save to file option from the More... menu in the bottom window. A window pops up to allow you to choose the file to create or to which you want to append the message.
To extract a message into a file use standard UNIX output redirection:
% show n > filename
This is essentially equivalent to the command:
% cp $HOME/Mail/folder/n filename
The show command includes one extra line that the cp
command doesn't create:
(Message {folder}:{n})
First, a note about message removal: When you use rmm
in mh, or the delete button in exmh, the files are not actually deleted. They are renamed with a comma (,
) or pound sign (#
) in front so that exmh/mh doesn't recognize them as messages. The files are still there consuming disk space, and they don't go away unless YOU do something about them.
You can choose to periodically go through and clean out the old files that you no longer need in order to recover disk space. In exmh, use the Purge All Folders button (under the More menu in the middle window). This will delete the message files older than (default of) 7 days which you had previously "renamed". Or manually use the UNIX command rm
on all files beginning with a comma (,
) or pound sign (#
).
A better solution is to add an entry to your .mh_profile
changing the behavior of the Delete button /rmm
command:
rmmproc: /bin/rm
This will really delete the message files when you use rmm
(mh) or when you hit the Commit button after deleting messages (exmh). For clarity in the following text, we simply refer to deleting messages.
To delete one or more messages, first mark them for deletion by selecting the headers in the middle window then click on Delete from the bottom window. The message headers you selected will be highlighted; on some terminals they will be a different color or have a background pattern. If you are sure that you want to delete the marked messages, click on the Commit button in the middle window. If you change your mind before you commit, select the messages you do not want to delete and unmark them (UnMark is an option under More... in the bottom window).
Note that after selecting a message, the cursor may move down to the next one, making it current rather than the one you selected. Make sure the cursor is placed correctly before unmarking a selection.
Use the rmm
command to remove messages:
% rmm [n m ...]
Delete the current (or specified) message(s).
To create a new folder from within exmh, select New from the middle window. The following window pops up for you to fill in. When you're done, click OK to create your new folder.[Missing image]
To switch current folders, click on the desired folder name in the top window with the left mouse button and the message headers from that folder will display in the middle window. It is now the current folder. You can read and work with the messages from this folder.
To view nested folders and their contents (see section 12.4.2), click the "parent" folder with the middle mouse button, then select a nested folder with the left mouse button.
To remove a folder, select it, then click on Delete folder under More... in the middle window.
When you refer to a folder on the command line, precede it with a plus sign (+
). To create a new folder, enter:
% folder +new_folder_name
There are a few ways to reset the current folder to a different one. The most explicit command for this is:
% folder +new_current_folder
Or, just running one of several commands with a different folder name changes the current folder until you again change it to something else. For example:
% scan +folder_name
Display message headers from folder_name and set this folder to current.
% show +folder_name
Display the current message in folder_name and set this folder to current.
Note that the refile
command (see section 12.3.10) accepts folder name arguments but doesn't change the current folder.
% rmf +folder
Delete the specified folder.
To refile one or more messages into a different folder, first select the header(s) in the middle window, then click the right mouse button on the destination folder in the top window. If they're moving to a nested folder, first click on its parent folder with the middle mouse button, and then on the nested folder with the right mouse button. The messages are now marked for refile. The message headers will be highlighted; on some terminals they will be a different color or have a background pattern. Click the Commit button (middle window) to complete the refile operation. If you change your mind before you commit, select the messages you do not want to refile and unmark them (UnMark is an option under More... in the bottom window).
Note that after selecting a message, the cursor may move down to the next message header, making it current rather than the one you selected. Make sure the cursor is placed correctly before unmarking a selection.
To move the current message (or specified messages) from the current folder to a different folder, enter:
% refile +folder [n m ...]
To search messages in a folder, first select the folder in the top window. Then select Search... from the middle window's menu and select the relevant option. You can get help on various items by looking into the search help. If you choose Find in table of contents, for example, you get a Find Tool window where you can type in a search pattern. [Missing image]
The headers of the "found" messages are highlighted. You can then display only the headers of these messages by choosing List only selected messages from the More... menu.
The Pick by Attributes from the Search... menu provides an interface to the MH pick
command. This is a more sophisticated feature that allows you to set up complex logical search expressions. If you use the "before" or "after" search criteria, the date format accepted is nn-mmm-yyyy
, for example 12-jan-1996
. [Missing image]
You have the option of saving the sequence of the picked messages. MH sequences are stored lists of message numbers. When you've finished setting up your search criteria, click Pick.
Another option you have is to use the glimpse utility, also available under the Search menu for full text searches. This requires building an index (use the menu option index under Glimpse full text), which may take a long time. For more information see the man pages for glimpse.
Pick
searches messages within a folder for the specified contents, and then identifies those messages. Two types of search primitives are available: pattern matching and date constraint operations. See the man pages for more information on pick
.
% pick -help
Display a list of pick options.
% pick options
Select messages by content, date, sender, recipient, etc.
You can use pick
to 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. To tell pick
to scan through every line of every message in the folder recent_work
and return the message numbers with the word "quark" in them, enter:
% pick -search quark +recent_work
Here is an example showing the selection of messages within a date range:
% pick -after 1-dec-1995 -and -before 1-jan 1996
You can use pick
with sequences, which are described above in the exmh portion. Commands that accept message numbers accept sequences as well; just type the sequence name. For example, find all messages received from sendername, and store them in the sequence picked
:
% pick -from sendername -sequence picked
The result also tells you how many messages are picked. You can then scan these messages by typing:
You can search for a string within the sequence by typing, for example:
% pick -subject 'quark substructure' -sequence picked
You can use pick
and scan
together (note the use of backquotes here):
% scan `pick -from sendername`
ups list -l exmh
to see the list of product dependencies.
unseen-sequence: unseen
and repl:
to your .mh_profile
.
Key-Delete
. Click on Save.
exmh-async editor
.