© 2008 by the Rector and Visitors of the University of Virginia.

The information contained on the University of Virginia’s Department of Information Technology and Communication (ITC) website is provided as a public service with the understanding that ITC makes no representations or warranties, either expressed or implied, concerning the accuracy, completeness, reliability or suitability of the information, including warrantees of title, non-infringement of copyright or patent rights of others. These pages are expected to represent the University of Virginia community and the State of Virginia in a professional manner in accordance with the University of Virginia’s Computing Policies.

A Primer for Mail on RS/6000 Computers

A Primer for Mail on RS/6000 Computers

 

Contents

Introduction
Additional Documentation
Acknowledgments
Registering for Network Mail
Reading Mail
        Commands
        Downloading Mail 
Sending Mail
        Tilde commands
        Uploading Messages
Appendix A: Setting up private mail aliases
Appendix B. Getting Additional global aliases for yourself
Appendix C: Quick reference chart (under construction)

Introduction

This primer is intended to be a basic introduction to the electronic mail program called the Mail User's Shell or Mush on the RS/6000s. Commands for sending and reading electronic mail are presented here. For information on other mailers and mailers for other Unix systems (Sun Workstations, SGIs, and NeXTs), see document U-010, ``Unix Mail Overview''.

When the command mail is typed on the RS/6000s, you will get a customized version of Mush. (The command mush will also get this mailer.) If you prefer to use a version of Mush similar to the ucb mailer, refer to Note 1 in Document U-010.

Procedures for sending and reading mail are very different, even though they rely on the same command. Both procedures will be discussed in this document. In sending mail, you can prepare your message in a separate file or type in the text at the terminal while in the mail program, but in both cases you specify one or more recipients (addresses) on the mail command line. If you do not specify any recipients on the command line, the mail program assumes you want to read messages that have been sent to you, and puts you in an interactive environment where you can read your messages.

Additional Documentation

For more information on electronic mail see the following documents:

 

U-010

Unix Mail Overview

TIB-137H

How Electronic Mail Works

TIB-137L

UVa's Local E-Mail Network

TIB-155

UVa's Wide-Area Mail Connections

 

Acknowledgments

Portions of this document were taken from the Virginia's Public Education Network (Virginia's PEN) New User Manual written by Ken Guyre, for the Virginia Department of Education.

Registering for email

 Mail registration is necessary to associate the address loginid@virginia.edu with the full address showing the machine name (e.g., loginid@poe.acc.virginia.edu) as well as to enter your email address into UVa's ``whois'' database.

If you have Umenu installed, from the main menu choose System Customization and then select Register for mail.

If you use the Unix prompt instead of Umenu, enter the command:

mailreg

This command does not work from within mail.

You will be prompted for your last name and your social security number.

Your registration request causes a specially formatted mail message to be sent to the network mail server. The server will send return mail to you confirming your registration request or indicating errors that prevented the server from updating its database. We advise that you save the registration request returned to you by the server for future reference.

Reading mail

The Unix system handles all mail sent to it by appending each piece of mail - called a message - to a special system mailbox file associated with each user account. If mail is waiting for you when you log in, you will see a message similar to You have mail before your login session begins. In order to retrieve the messages that have been stored in your mailbox, type

mail

Because you specified no recipients, you have asked mail to start up a mail session; that is, to look in your system mailbox file, print a list of messages waiting to be read, and leave you in an interactive environment which accepts commands to browse through your messages. If you try to retrieve mail when there is none waiting for you, the mail program simply says, No mail for userid and does not begin a mail session.

The first time you use mail you will get an introductory message that tells you about using help. Press RETURN at the -- more -- prompt to continue reading this message. After you have read the message, you will see the menu for reading mail (see Figure 1 below).

Type 'help' for general help, type '?' for a list of all commands. 
"/usr/spool/mail/iju4b": 2 messages, 2 new, 2 unread
 1 >N lal@aplcen.apl.jhu.e Feb 14 11:57 (35 lines) Training Document
 2  N cbe10@odumv.cc.odu.e Feb 17 15:05 (23 lines) Statewide network 
=== (r/R) reply/replyall (d) delete  (for)forward  (sa) save (he) help 
===  (N)  display msg N  (h) headers (do) download (se) send (q)  quit 
=== iju4b: #l of 2> __ 

 

Figure 1. Reading Mail Menu

A list of the headers of the messages in your mailbox, a menu of commands, and a prompt are displayed. The list of message headers gives you the message number, the status of the message (N=new, etc.), who sent it, when it was sent, how long the message is, and the subject of the message. The prompt is in the form:

loginid: #n of m>

where

loginid  is your loginid (mailbox name).
n  is the number of the current message.
m  is the total number of messages in your mailbox.

When you read a message, you will see information presented on your screen similar to what is shown in figure 2. The first portion of the message is called the header. It gives you the message number and length, the recipient(s) of the message (To: and Cc:), what the message is about (Subject:), when the message was sent (Date:), and who sent it (From:). If the message has been routed through the network, there will be additional header lines describing the routing.

The rest of the message is the body. If the message is too long to be displayed on your screen, it will stop at the bottom of the screen, give you a prompt -- more -- and wait for a response. If you want to continue reading, press the RETURN key or the space bar. If you do not want to see the rest of the message, type the letter q. When the system has finished displaying the message, the reading mail menu will be displayed on your screen where you can enter your next command.

Message #1 (35 lines)
From root Fri Feb 14 11:57 EDT 1991
To: iju4b@virginia.edu
Subject: Training Document
Cc: tms8p@virginia.edu, lmorgan@cvgs.schools.virginia.edu, iju4b
Date: 14 Sep 90 11:57:37 EDT (Fri)
From: lal@aplcen.apl.jhu.edu  
Ivan,  
I have reviewed your training document and I think you have done
an excellent job in providing a reference to the system.  
-- more -- 
I would like to recommend that, for initial training, a loose
leaf document be prepared with plenty of empty space for the
students to make notes.  
Lee  
=== (r/R) reply/Replyall (d) delete (for) forward  (sa) save (he) help 
===  (N)  display msg N  (h) headers (do) download (se) send (q) quit 
=== iju4b: #l of 2> __ 

 Figure 2. Displaying a Message

 

The most frequently used commands are displayed in the reading mail menu:

===     (r/R) reply/Replyall (d) delete   (for) forward   (sa) save  (he) help
===     (N)  display msg N   (h) headers  (do) download   (se) send  (q)  quit

To invoke a command, either type the name of the command or the letter(s) displayed in parentheses in front of the command. If you issue a command (reply, forward, delete, save, etc.) without a message number, the command acts on the current message. To issue a command on a particular message or messages, specify the message number(s) on the command line. For example:

d  1-3

(deletes messages 1 through 3)

for  5

(forwards message 5)

sa  2,7,9  file

(saves messages 2, 7, and 9 in the file named ``file'')

Commands

r/R -- reply/Replyall The reply command allows you to construct a reply to the sender of a message. The Replyall command, R, allows you to construct a reply to all recipients as well as the sender of the message. Mail will use the addresses from the original message to construct the correct addresses for the reply (or Replyall). Once it has done this, you will be in ``sending mail mode,'' which will be discussed in the next section. When you have finished composing the message and have sent it, the reading mail menu will be displayed on your screen.

d -- delete The delete command deletes a specified message or messages, or the current message if you do not specify a number. If you decide that you want to recover a deleted message, you can use the undelete command, u. The undelete command brings back a message you had deleted earlier in the current mail session. You must specify a message number in order to undelete it. Deleted messages do not appear in the list of message headers.

for -- forward The forward command, for, allows you to send a copy of a message to another mail user (address). After supplying the address the message is immediately sent (so you cannot add anything to the message being forwarded).

sa -- save This command saves a message or messages in a file on your Unix account whose name you supply. If the file already exists, the message will be appended to it without destroying its current contents.

he -- help This command displays the general help message. To get a list of all the available commands type ? at the prompt. To get help on a specific command use the -? option (for example,
delete -? gives you information about the delete command).

N -- display msg N This option allows you to display (read) a specific message from your mailbox. Enter the message number associated with the header of the message that you want to read.

h -- headers When you first enter mail, a list of message headers is displayed. To display this list again type the headers command, h. The list will be updated to reflect which messages you have read, saved, and deleted. It prints only a partial list in the vicinity of the current message (the message with `>' in front of it). If you have more message headers than will fit conveniently on the screen, type h + to see the next screen of message headers, and type h - to see the previous screen.

do -- download This command allows you to download a message to your microcomputer disk, using one of several file transfer protocols. It will be explained in detail in a later section of this document.

se -- send You can use the mail command se to send a message while you are reading mail. This command puts you in the ``sending mail mode.'' A complete discussion of this mode and the available commands are explained in the next section.

q -- quit The quit command, q, terminates the mail program and returns you to the shell. Messages which you have read and not deleted or have not read are saved in your mailbox. Those you have deleted are thrown away permanently (that is, cannot be recovered with the undelete command).

w -- write Similar to the ``save'' command above except this command saves a message or messages in a file on your Unix account without including the mail headers.

x -- exit Similar to the quit command, except this command does not update your mailbox. Any changes you made, including deleting files, will not occur. Your mailbox will be the same as it was when you began the current mail session. This can be useful if either you or the system have caused changes to your mailbox that you do not want to apply.

There are many additional commands you can use while reading mail. This document covers the commands displayed in the reading mail menu. See the man page on Mush for more information on these other commands.

Additional commands worth mentioning are lpr and x. The lpr command allows you to get paper copies of your mail messages. The syntax of the command is:

lpr [-Pprinter] [<msg-list>]

If you have specified a printer in your .profile or .variables.ksh file (PRINTER= ) then the printer option, -P, is not needed. If you do not specify a message number, the current message is printed.

Downloading Mail

While reading your mail messages, you can download copies of these messages to your microcomputer. You can perform the transfer to the Unix machine via NCSA telnet or LAN Workplace under Windows, which supports FTP (file transfer protocol) or via several protocols available with communications packages. If you are using the microcomputers in ITC's workstation facilities, you are using NCSA telnet or LAN Workplace to connect to your Unix machine.

=== (r/R) reply/Replyall (d) delete (for) forward (sa) save (he) help 
=== (N) display msg N (h) headers (do) download (se) send (q) quit 
=== iju4b: #1 of 2> do
Saving msg 1 ... (35 lines) 
Saved 1 msg to /tmp/dl942 
----------------------------------------------------------------------- 
Download Protocol 
Download via dial-in connection 
1) kermit 
2) xmodem 
3) xmodem-1k 
4) zmodem 
Download via FTP using a network connection 
5) PC (running NCSA Telnet) 
6) PC (running LAN Workplace under Windows) 
7) Macintosh (running NCSA Telnet) 
8) other (running other TCP/IP software) 
(h) help (q) quit 
Your Choice: 1
----------------------------------------------------------------------- 
File Type to Download 
 
1) text (ascii, BinHex, uuencoded) 
2) non-text (binary, graphics; e.g., gif, tif, jpeg) 
(h) help (q) quit 
Your Choice: 1
-----------------------------------------------------------------------
Performing text file download via kermit. Continue (y/n)? y
Name to be used on your computer for the downloaded file: 
(e.g., B:/download.txt): training.msg 
 
Kermit now sending. Please begin receiving ... 
[Perform PC actions required to receive kermit (or ftp) files] 
=== (r/R) reply/ Replyall (d) delete (for) forward ( sa) save (he) help 
===  (N)  display msg N   (h) headers (do) download (se) send (q) quit 
=== iju4b: #l of 2> __

Figure 3. Downloading Screen

 

When you select the download command (do), two system messages will be displayed and you will be presented with the download sub-menu (see Figure 3 above). First choose the appropriate file transfer protocol. Next you will be asked about the type of file that you want to download. You can choose to download a text file (standard message) or a non-text (binary) file such as a Lotus spreadsheet or a graphics display (note that some PC Kermit software may not support the binary mode).

When you have specified the type of file to download, you will be asked if you want to continue. Type a "y" followed by a carriage return if you want to continue. Next you will be asked for the file name as it will appear on your microcomputer. This must be a valid name for your type of microcomputer and the file will normally be placed in the directory containing your emulation software. When you receive the message to begin receiving, you must perform whatever procedures are required for the transfer protocol you selected (for Kermit using ProComm Plus press <PgDn> and select Kermit from the microcomputer menu; for FTP, follow the directions on your screen).

When the transfer is complete, the reading mail menu will be displayed on your screen. Downloading a message does not delete a message from your mailbox so you should use the delete command (d) to delete it.

Sending mail

You can send mail by typing

mail <address>

either outside of Mush at the Unix prompt or inside of Mush at the prompt. You can also use the command:

send <address>

inside of Mush.

The address identifies the recipient(s) of your mail. To send a message to more than one person, enter each address on the mail (or send) command line separated by spaces or commas. An address can be the loginid of a person on the same Unix machine or a remote mail address in the form:

mailid@host

where host is the network address of the system on which the user receives mail. Usually this address includes a system name and domain (for example, virginia.edu, vtvm1.cc.vt.edu or rice.edu).

If you frequently send messages to the same person at another system or to a group of people, you may want to create a mail alias. This is a single word which can represent a remote address or a group of addresses. Details on how to create aliases can be found in Appendix A.

poe: /home/iju4b (iju4b) $ mail kko5g
End your message with a '.' on a line by itself. 
Press ESC then 'u' to upload a file; type '?' for help on tilde commands. 
To: kko5g 
Subject: Sample Message  
This is a sample of how to send a message. Note that the line will
wrap automatically so that carriage returns are required only to
end a paragraph. 
.
send, continue editing, discard [s,c,d]? s 
poe: /home/iju4b (iju4b) $ __ 

 Figure 4. Sending Mail Screen

 

After typing the mail command with the address, you will be prompted for the subject of the message (see Figure 4 above). If you do not want to enter a subject, press RETURN.

You are now ready to compose your message. This can be done in one of three ways or a combination of the three ways. The easiest way is to start typing the message. This version of mail will automatically wrap the words at the end of the line. If you make a typing mistake, you can correct it (as long as the mistake is on the same line as your cursor) using the BACKSPACE or the CTRL-H key. A second way to enter the message is to use an editor (such as Vi or JOVE; see the tilde commands below). The third way of entering the message is to upload a previously prepared message from your microcomputer. The method for doing this will be described in a following section.

When you have finished entering a message, type a period (.) as the first and only character on a line. You will then be asked if you want to send, continue editing, or discard the message. If you select continue editing (c), you will be put at the end of the message so you can enter more text. If you select discard (d), the message will be appended to the file dead.letter and will not be sent. Selecting send (s) will send the message.

Tilde Commands

While you are composing a message, mail treats lines that begin with the tilde (~) character in a special way. These tilde commands, sometimes called tilde escapes, can be used to change header information (that is, modify the recipient list and subject or add carbon copy recipients). They are also used to invoke an editor for editing the text of your message. You can type a tilde command at any time while entering the text of your message, as long as you type it at the beginning of a line. The command ~? prints a brief description of all the tilde commands.

As you compose your message, you may prefer to use an editor (e.g., Vi or JOVE). To do this, use the tilde command ~e. Mush will invoke the editor that is set with the Unix shell variable EDITOR, which is usually set in your .profile or .variables.ksh file. When you have finished your message, leave the editor by saving your changes and quitting the editor normally. At this point mail takes over again with the message, (continue editing letter). To finish, end the message the same as if it were a message you had typed in at the terminal, by using a period (.) on a line by itself.

The ~e command only allows you to edit the text of your message. To edit or add one of the headers (To:, Cc:, Bcc:, or Subject:) use the following commands:

~s

[subject]

Modify [Set] subject

~t

[address(es)]

Modify [Add] address(es) to To: list

~c

[address(es)]

Modify [Add] address(es) to Cc: list

~b

[address(es)]

Modify [Add] address(es) to Bcc: list

~h

Modify all message headers

Specifying an option for the header sets (~s) or adds to (~t, ~c, ~b) the current header information. Invoking the commands without options modifies the existing header information.

Before you send a message, you should review the message body and the headers with the command ~p. This will show you exactly what the person receiving the message will see.

Sometimes you may wish to send a colleague a copy of a file or a program from your Unix account. To include an existing file in your mail message, use the tilde command:

~r filename

To save a copy of the message contents in a file, use the tilde command:

~w filename

When composing a message, you may decide not to send it. The command ~q aborts sending mail and appends a copy of the message you were composing to the file dead.letter. The command ~x aborts mail without saving a copy of the message.

Uploading Messages

As with downloading a file, uploading requires that you connect to the Unix machine via NCSA telnet or LAN WorkPlace under Windows, which supports FTP (file transfer protocol) or that you dial-in using a terminal emulation package (xmodem or a package that supports the Kermit file transfer protocol). You can invoke this upload capability at any point while entering the body of a message by pressing the escape key (<ESC>) and then typing the lowercase letter ``u.'' You will then see the upload sub-menu (see Figure 5 below). First choose the appropriate file transfer protocol. Next you will be asked what type of file to upload. You can upload either a text file (standard message) or a non-text (binary) file such as a Lotus spreadsheet. At this point you will be asked if you want to continue. Type a "y" followed by a carriage return if you want to continue.

When you receive the message to begin sending, you must perform whatever commands are required for the transfer protocol you selected (for Kermit using ProComm Plus press <PgUp> and select Kermit from the microcomputer menu; for FTP, follow the directions on your screen).

<ESC> u
~:sh upload /tmp/ul9977
---------------------------------------------------------------- 
Upload Protocol 
Upload via dial-in connection 
1) kermit 
2) xmodem 
3) xmodem-1k 
4) zmodem 
Upload via FTP using a network connection 
5) PC (running NCSA Telnet) 
6) PC (running LAN Workplace under Windows) 
7) Macintosh (running NCSA Telnet) 
8) other (running other TCP/IP software) 
(h) help (q) quit 
Your Choice: 1 
---------------------------------------------------------------- 
File Type to Upload 
1) text (ascii, BinHex, uuencoded) 
2) non-text (binary, graphics; e.g., gif, tif, jpeg) 
(h) help (q) quit 
Your Choice: 1 
---------------------------------------------------------------- 
Performing text file upload via kermit. Continue (y/n)? y 
Kermit is now receiving. Please begin sending ... 
[Perform PC actions required to transmit Kermit (or ftp) files] 
(continue editing letter) 
~r /tmp/ul9977 
/tmp/ul9977: 28 lines 
(continue editing letter) 
~:sh /bin/rm -f /tmp/ul9977 
(continue editing letter) 
__

Figure 5. Uploading Screen

 

When the transfer is complete, several messages will be displayed on your screen. After the third (continue editing letter) message appears, you can continue with normal processing of your message.

Appendix A

SETTING UP PRIVATE MAIL ALIASES

If you frequently correspond with someone whose address is hard (or long) to type or if you correspond with a group of people, you should create aliases for the addresses. Aliases, which can be used for individuals or for a group of people, are created in a file called .mailrc. Each time the mail program starts up, whether for sending or reading messages, it first looks for a file called .mailrc in your HOME directory. When you use an alias from this file for an address, mail will use the full address(es) found there.

To create the file .mailrc use your favorite editor. The form for aliases is:

alias alias-name address(es)

For example, suppose I had the following lines (aliases) in my .mailrc file:

alias Doug flutie@vap.dnet.nasa.gov
alias fred carter@mpib-martinsried.mpg.dbp.de
alias unixgrp jji@virginia.edu, lpq4r@virginia.edu, oip@virginia.edu

alias Doug flutie@vap.dnet.nasa.gov
alias fred carter@mpib-martinsried.mpg.dbp.de
alias unixgrp jji@virginia.edu, lpq4r@virginia.edu, oip@virginia.edu

Now when I type mail fred, the message will be sent to carter@mpib-martinsried.mpg.dbp.de. A message sent to unixgrp will go to all three addresses listed. Note that while mail addresses like brown@vap.dnet.nasa.gov are case-insensitive, private aliases defined in the .mailrc file (like Doug, above) are case-sensitive.

The default .mailrc file can be found in the directory /help/unix/account.customize/startupfiles. To copy this file to your account, go to your home directory and type the command:

cp /help/unix/account.customize/startupfiles/.mailrc .
 

Appendix B

GETTING ADDITIONAL GLOBAL ALIASES FOR YOURSELF
 
It is possible to have additional aliases created for you at the
virginia.edu level of the mail system. For example, if you
want to tell your friends outside the University to address mail to
you as Lefty@virginia.edu, then you would make a request to have a
"Personalized Electronic Mail Alias" set up for you with that
name. Like other mail addresses, such aliases are case-insensitive.
Your friends inside the University can also use that address,
but for them it is probably simpler to set up the alias Lefty in their
own .mailrc file, as explained in Appendix A.
 

There are, of course, some restrictions on permissible aliases of this
kind. No duplications can occur and aliases cannot conflict with
regular mailids. We will also reject aliases which we judge to be in poor
taste.

Up to three of these aliases are published in the University
Directory, along with the initial alias created by registration at the
virginia.edu domain level. To apply for a Personalized Electronic
Mail Alias, send electronic mail to postmaster@virginia.edu.