======================================================================= U N I X T U T O R I A L by Glenn Chappell ======================================================================= Unix Tutorial (September 1994 version) by Glenn Chappell (Feel free to distribute this document however you want.) Chapter V. Mail ************************************************************************ Note: At this point, the basics of Unix have been covered. The next two chapters cover specifix Unix commands: chapter 5 covers "mail", which allows you to send and receive electronic mail. Chapter 6 covers "vi", an editor. If you want to use a different mailer and/or a different editor, you can skip whichever chapter doesn't apply to you. However, you still might want to read chapter 7, which is about learning more on your own. ************************************************************************ If you are like me and many others, one of the main things you will be doing with Unix is sending and receiving electronic mail (e-mail). There are many programs available to do this: mail, msg, elm, pine, xmail, etc. "mail" has the advantange that it is available on nearly all machines. ----- Part 1 - The mail command ----- Covered: mail Mail commands: mail q x "mail" is a program, and so you run it by typing its name: % mail Unlike the commands I have shown you so far, mail doesn't just do its job and leave. Instead, it gives you its own prompt: "&" (which can be changed, by the way. Whatever your mail prompt happens to be, I will use "&" for the mail prompt here, just as I used "%" for the csh prompt). Now that you know how to get into mail, you need to know how to get out. The usual way to leave is "q" for "quit": & q or, if you're afraid you might have messed something up, use "x" for "exit", which doesn't save any changes you have made to your mailbox: & x When sending and receiving e-mail, most of the people you correspond with will be identified by what is called an "Internet-style address". "Internet" refers (somewhat correctly) to the international conglomeration of networks connecting thousands of computers. It is used for electronic mail, file transfer, remote logins, etc. Generally, an address is of the form "username@xxx.xxx.xxx.xxx", where the number of periods after the "@" may vary. "username" is just the username, while xxx.xxx.xxx.xxx is a unique identifier for the machine that the user is on. Most academic computers in the U.S.A. are identified as "machine.department.school.edu". For example, one of my addresses is chappell@symcom.math.uiuc.edu This indicates that I am "chappell", on the computer called "symcom", which is run by the math department at the University of Illinois at Urbana-Champaign, which is in the "edu" (education) domain. There are many other domains, such as "gov", for "government", "com" for "communications", or "uk" for "United Kingdom". Other symbols which are sometimes used in addresses are "!" and "%", but we don't need to be concerned with those right now. To send e-mail to another user, the command is % mail username from the C-shell (with "username" replaced by the appropriate Internet-style address), or & mail username from mail. These two commands look very similar, but they are actually quite different. "% mail username" tells the C-shell to run the "mail" program and give it the parameter "username", while "& mail username" executes the mail command "mail" with the parameter "username". However, the effect of the two is much the same. Thus, to send mail to me you would type % mail chappell@symcom.math.uiuc.edu or, if you were already in "mail", & mail chappell@symcom.math.uiuc.edu If you are on the same machine that I am, you could just type % mail chappell When no machine is specified, the local machine is assumed. Both the % and & versions of the "mail" command will take multiple parameters. You could thus send a message to both me and yourself with % mail chappell@symcom.math.uiuc.edu YOURNAME replacing "YOURNAME" with your user id, of course. or & mail chappell@symcom.math.uiuc.edu YOURNAME Note that there are no commas or other punctuation between the addresses. It is required that there be spaces between the addresses and *no* spaces inside the addresses. You may very well want to send yourself several messages now so that you have some messages to experiment with. Note: I will not be doing a "walk through" with the following commands, but I would suggest that you try them all. The csh "mail" command has several optional parameters (as do nearly all csh commands). One of the most usful of these is "-f". This stands for "file", and is used to tell "mail" to look in a different file for messages. Normally, mail looks in your incoming mailbox, usually "/var/spool/mail/YOURNAME". When you quit mail in the usual way ("q"), it transfers all the messages you read, but did not delete, to a file called "mbox" in your directory. To look at the messages in mbox, you would type % mail -f mbox Note that this only works at the csh prompt. If you have another file of messages you would like to look at, say "msgs", you could type % mail -f msgs At this point, you may be wondering how you would create the file full of messages (msgs) described above. That is explained under the "s" command, below. ------------------------------------------------------------------------