Forwarding, Sending, and Reading Mail on the CS Linux Machines

Introduction

(In this discussion, you should read "Unix" as "Unix and similar operating systems such as Linux".)

If you send mail from your CS Linux account (for example, if you submit program source code by mail), you will usually get some sort of response via e-mail (either an automated reply or a message from the mail daemon telling you about a problem such as a mistyped address). This e-mail will be routed back to the sending account, however, which means that you either need to forward it to another account or read it using a Unix mail-reading program.

Forwarding mail under Unix

It may be simplest just to forward mail from your CS account to the address where you normally read mail (for most of you, your TUITS account). To do this, create a text file called .forward in your home directory containing the address to which you want mail forwarded. For example, if you want mail forwarded to your TUITS account, and your username is yourname, this file should contain the single line of text yourname@trinity.edu. (To create a text file, use your favorite text editor, e.g., the one you use to write your program source.) Permissions on this file should allow others to read it but not change it; you can ensure this with the command chmod 644 .forward. Note that you won't normally see this file in a directory listing -- files beginning with a "." do not normally appear in a Unix directory listing (as produced by the command ls). To see all files, including those beginning with a ".", use the command ls -a. To be sure permissions are set correctly, use the command ls -l .forward; you should see output that looks something like this:
    -rw-r--r--    1 yourname yourname       27 Jan 22 12:51 /users/yourname/.forward
(The important part is the first 10 characters, showing that you have permission to read and change (write to) the file, and everyone else has permission to read it but not change it.)

To check that forwarding is working properly, try sending a test message from some other account -- your TUITS account, for example -- to yourname@cs.trinity.edu. The test message should arrive at the address to which you've forwarded your CS mail within a few minutes (assuming there are no network problems); if it does not, something is probably wrong, and you should review the instructions and/or ask for help.

Sending mail under Unix

A quick way to send one file from Unix is to use the mail command: mail [-s "subject"] [-c cc_recipient] recipient < filename sends the contents of file filename as an e-mail message to recipient, with a subject header of subject. Also sends a copy to cc_recipient. If the message cannot be delivered, you will get mail to that effect, but the mail will be sent to your CS account (so you should set up forwarding, as described above, or learn how to read mail sent to your CS account, described below). You can send mail with attachments from the command line using mutt. Syntax is the same as for mail, but for each attachment you include -a filename. Or you can simply use a Web-based mail, which should allow you to access the local filesystem(s).

Reading mail under Unix

If you do not forward mail from your CS account, you should be able to retrieve it via IMAP or POP from sol.cs.trinity.edu. There are other options as well; talk to your instructor or send mail to the CSadmin mailing list (address posted in most labs).