How to Use the Internet and E-Mail Norman Matloff University of California at Davis (916) 752-7004 matloff@heather.cs.ucdavis.edu Modified slightly by Scot Kleinman 30Apr97 April 13, 1995 Using E-Mail What will be described here is the ordinary (``vanilla'') Unix program mail. There are many other mail programs, notably pine, elm and mush. Sending Mail Sending Ordinary Messages Simply type mail address, where address is the recipient's network address. (Keep in mind that you can shorten the address if you are in the same domain, as indicated above.) After you type this command line, you will be prompted to give a subject title for your message, and then you type your message itself. Type ctrl-d to terminate and dispatch your message. If during the typing of your message, you discover an error or wish for some other reason to change your message before dispatching it, you can edit it. Typing the tilde character and the letter `v', i.e. ~v in the first (leftmost) character position of a line in your message will invoke the vi editor, filled with the message text you have typed so far. You can then edit the text as usual. When you are done, type ZZ as usual to leave vi, putting you back in send-mail mode, and type ctrl-d to terminate and dispatch your message as explained above. (An introduction to vi is given in the document ``Unix--the Bare Minimum.'') Sending Files You can use mail's editing capability to send files. From within mail, type tilde-v to get into vi as above, and then use vi's r command to read in the file into your message text. Another method, simpler but less flexible, is to just use Unix's redirection capability. Suppose you want to send the file HayFeverRemedies to a user Laura on the machine named achoo. Then simply type mail laura@achoo < HayFeverRemedies (Note that mail is a program. That program was written to read from the keyboard, but the use of < tricks the program; the program thinks the input is coming from the keyboard, but it is actually coming from the file HayFeverRemedies.) The standard mail system is only capable of sending 7-bit ASCII characters. Sending a file with 8-bit characters will in most cases result in corruption of the file. Executable files, tar files, and compressed files contain such characters, so we can not mail them in their raw form. The Unix programs uuencode and uudecode solve this problem. Reading Mail Your incoming mail will be deposited in your system maildrop. This file is typically /usr/spool/mail/your username. Again, this is just an ordinary file. footnote: To illustrate this point, note that one (rather crude) method for me to delete all my accumulated mail messages would be to type rm /usr/spool/mail/matloff I certainly don't recommend this--it's better to read one's mail before discarding it!--but this does illustrate the idea that the maildrop is just an ordinary file. To read your mail, simply type mail from the Unix shell prompt. Determining What Messages You Have You will be given a list of your messages, with a number for each one footnote: .If you have more than a screenful of messages, you will only see part of the list at a time. To see a specific part of the list, use mail's h command. E.g. type h 21 to see the part of the list which begins with Message 21 or you can type 'z' to see the next screenful of messages, but hopefully, you save and/or delete your mails after reading them, so this will not apply to you. You can specify the number of the message you want to read, or you can simply hit the carriage return to read the next sequential message. Deleting Messages First of all, no message will be deleted at all unless your exit from the given mail session is done via the q command (see below). Under that condition, the following will be true: 1. Any messages which you deleted in that session by using the d command will disappear completely. That command works as follows: If submitted without a number, the current message will be deleted. It can also be used to delete a message or a set of messages specified by numbers; e.g. d 12 25-32 would delete messages 12 and all those with numbers in the range 25-32. 2. Any messages which you read but did not apply the d command to will be moved out of your regular mail file, /usr/spool/mail/username (where of course `username' is your account name, e.g. sjk), into the file `mbox' in your home directory. If you want a message you have read to stay in your regular mail file, you may "unread" it after reading it with the (what else?) "unread" command. However, if you do not wish to do this, or if you will do this from now on but still have an mbox file left from before, you mail read the mail in your mbox file by typing mail -f mbox from your home directory. Making a Permanent Copy of a Message The s command will save a set of messages to a file. E.g. s 5-16 Sports would save copies of messages 5 through 16 to a file named Sports. (If the file already exists, messages 5-16 will be appended to it.) Replying to a Message This can be done using the r and R commands. Using r will reply to the sender only, while R will result in replying to both the sender and to everyone else the sender sent the original message to. footnote: Beware! On some systems, these roles of r and R are reversed. Make sure you understand this before you use a system, especially if you are going to send something which is confidential. Using these commands, you are sending a message, and thus all the material listed above on sending messages applies. When you reply to a message, you will find that it is usually convenient to include some of the lines from the original message in your reply. In this way, you can respond line-by-line, i.e. juxtaposing lines from the original message with your replies to those lines. To do this, use the ~m command, which will copy the original message for you, followed by the ~v command, which puts you in the vi editor. You then are editing a copy of the original message. Use the editor to delete lines you don't want to include from that original message, and then use the editor to add your replies to the lines you keep. For example, suppose someone sends me the message In Assignment 3, do you want us to include error-checking? It would make the program double the size. I can then display the sender's original text in my reply: > In Assignment 3, do you want us to include error-checking? It No. > would make the program double the size. Yes it would, so please do not include such code. It is customary to indicate the sender's text by using special marks at the beginning of a line, such as the `> ' I have used here (most non-vanilla mail programs, such as mush, do this for you automatically). IMPORTANT NOTE: As a courtesy to the person whom you are sending the e-mail, when you are typing an e-mail message, PLEASE hit the carriage return every time you want to make a new line. Do NOT simply allow the cursor to automatically go to the next line, because your message will then have very long lines which make it very difficult for the recipient to use > marks in replying to you. Leaving When you are finished reading your mail, type either x (``exit'') or q (``quit'') to leave. There is a big difference between the two methods of leaving. Use of q will result in truly discarding all of the messages that you had typed d for, and also discarding any that you typed s for. By contrast, use x will result in no messages being discarded. Conveniences Via a .mailrc File You can use an editor to set up a file called .mailrc in your home directory, which will make many things more convenient. For example, you can have a line set askcc crt=25 The askcc attribute means that when you hit ctrl-d to send a message, the mail program will automatically ask you, with a prompt ``Cc:'', if you want to send a ``carbon copy'' to anyone, in which case you enter their e-mail addresses. One good usage for this is sending a copy to yourself, so that you can keep a record of some important messages that you send. The crt=25 attribute tells the mail program to show you a message only 25 lines at a time, which is important if it is a long message. You could also put an alias in this file, e.g. alias nm matloff@heather.cs To send mail to matloff@heather.cs, you would just type mail nm instead of the longer mail matloff@heather.cs An alias can be used with several names. E.g., if you have alias jj jack@hilltop jill@hilltop then typing mail jj would have the same effect as typing mail jack@hilltop jill@hilltop Having Accounts on Multiple Machines If you do have accounts on multiple machines (which is common), you don't want to have to go to all the machines to read your mail. To avoid this, create a file named .forward in your home directory of all machines except the one on which you wish to read your mail. For example, my main machine is begonias.bbso.caltech.edu, so on sundowner, for example, I have in my home directory a file named .forward which contains sjk@begonias.bbso.caltech.edu If someone sends mail to me at to sundowner,, this file will make that mail get forwarded to me on begonias. E-Mail Culture Since tone of voice does not come through e-mail, a number of special symbols have been developed, the most famous of which is :-) which denotes a smile (turn your head 90 degrees to the left to view it!). There are a number of others, e.g. :-( for a frown. The Talk Program You can have an interactive discussion with other people who are currently logged in at any computer in the Internet world, no matter how far away they are. footnote: Exceptions: Some sites disallow this. Also, SPARCstations and DECstations are incompatible with each other for talk. To talk to anyone, simply type `talk' followed by his/her network address. You will see your screen split in two pieces, one showing what you type and the other showing what the other person types. When you want to end your conversation, just type control-c. Of course, the person must be logged on at the other machine, and currently using that machine (they may be logged on but still not using the machine; e.g. I am logged on to my office machine, Heather, constantly, even though I may not be using it). Using the Ftp Program The ftp program is very nice for transferring files from one machine to another. If you are on Machine X, you can use ftp to connect to Machine Y (as long as both are on the Internet), and then use the `put' command to copy files from X to Y, and the `get' command to copy files from Y to X. One really nice usage of ftp is anonymous ftp. Here you log in to sites all over the world which are open to the public. You log in under the username `ftp', and just send your e-mail address as the password. You do not need an account on the machine at that site. You can use anonymous ftp to get access to various databases, and to get a lot of public-domain (i.e. freely copyable) software. Literally thousands of free programs are available. (Almost all of the Unix programs are completely free, and about half of the DOS/Windows programs are completely free, with the other half being ``shareware.'' The latter term means the authors asks for a small donation.) For example, one of the most complete sites is wuarchive.wustl.edu at Washington University at St. Louis. Another one which has basically the same stuff (but sometimes is less busy than the Wash. U. site) is oak.oakland.edu To use ftp, merely type ftp site_address Commands like cd and ls work pretty much like their counterparts in Unix. One obtains files using the get command, and places files at the remote site using put. footnote: One can transfer multiple files with a single command, by using mget or mput. See ftp's on-line help for this. You can also use World Wide Web browser programs, such as lynx to do anonmyous ftp. In fact, you may find this easier and more convenient than using ftp! (See details below.) At most anonymous ftp sites, the goodies are in the directory `pub' and its subdirectories (the Wash. U. site is an exception; in this case, the stuff is in the directory `mirrors'). Directories typically include a file whose name is something like `000.index.txt', which describes all the files in that directory. When you first log in to the ftp site, type `bin', to set binary mode, i.e. 8-bit-character mode, since many of the files consist of 8-bit characters. (And it won't hurt, other than in slower transfer speed, if the file I get is 7-bit ASCII.) By the way, the biggest wealth of free Unix programs are those for X11 windows. Remote Login If you are logged in to one machine, and wish to log in to another from the first machine (e.g. in one window), just type `rlogin', followed by the network address. Norm Matloff Wed Nov 8 17:41:34 PST 1995 Last modified 30 Apr 1997