-->
Previous Table of Contents Next


Sending E-Mail with mail

You can send e-mail to an individual, a group of individuals, or a mailing list. Just as when you want to send a paper letter, you must specify the address of the recipient with e-mail. Sometimes, you’ll compose or write a message while you’re sending e-mail; at other times, you’ll send a prepared message; you may even send the output of a command or program with e-mail. When using mail or elm, the message you send has to be a text file—that is, an ASCII file.


NOTE:  The Simple Mail Transport Protocol (SMTP) is used to transfer mail between computers. It now supports only ASCII files. To send a binary file via e-mail, you have to convert the file to ASCII by using the uuencode utility.

Regardless of how the message is prepared, you send mail by using a command of the following form:


mail address

This command starts the mail system. You can then compose the mail message and send it to the specified address. In this syntax, address is the e-mail address of the person who is to receive the message. An address can have several different forms. To send e-mail to someone who has a login ID on the machine you’re using, use the login ID of that person. For example, to send e-mail to someone on your system whose login name is george, enter the following command:


mail george

If george is on another system that you can access through some network or collection of networks, you must include the name by which that system is known on the network. Suppose that george is the name of a user on a computer system whose network name is apples.startup.com. You can send e-mail by entering this command:


mail george@apples.startup.com

The exact form of the address depends on the type of network being used and any local conventions or rules. Ask a local expert or your system administrator about the form of addresses on a network in your company.

To send the same message to several users, include each of their addresses on the line with the mail command, as in this example:


mail fred bill george@apples.startup.com

Writing a Message While Sending E-Mail

Many users compose or write messages while they’re in the e-mail program, rather than compose a message beforehand. This is usually the quickest—but not the neatest—way to send mail. It’s not neat because you have limited editing capabilities while composing your message. Generally, you can deal with only one line at a time. First, you type the command to send e-mail, specify the address(es), and then press <Return>. Then you type the message, indicating that you’re done by typing a period on a line by itself. You can also use <Ctrl-d> to end the message. For an example of how to send e-mail to a user named lynn, enter this command to start the mail system and specify lynn’s address on your system:


mail lynn

Subject: Congratulations! Lunch Thursday?

Now type the message, pressing <Return> when you want to end a line. Here’s a sample message that you may want to send to lynn (press <Return> at the end of each line to space the paragraphs of the message):


Lynn,



Just wanted to tell you that I thought you did a great

job at the meeting yesterday! It seems as if we’re

finally turning this problem around.



Want to get together for lunch Thursday?

Give me a call.

joe

.

You can also end the message with <Ctrl-d> instead of a period. The computer responds by displaying EOT, which means end of transmission.

Canceling a Message

You can cancel a message while you’re writing it, but you can’t cancel it after it’s sent. To cancel a message while you’re writing it, press whatever key is configured on your system as the interrupt key (usually <Ctrl-c> or <Del>). When a message is canceled, it’s saved in a file named dead.letter. You can delete this file or edit it later for another message. When using mail, you must press <Ctrl-c> twice to cancel (in case you press <Ctrl-c> or <Del> by mistake). After canceling your mail message, you see the command-line prompt. The following example shows how the cancel function works:


mail lynn

Subject: Congratulations! Lunch Thursday?

Lynn,



Just wanted to tell that I thought you did a great

job<Ctrl-c>

 (Interrupt -- one more to kill letter)

You now must decide whether you want to continue the letter or kill it. If you decide to continue, you just keep typing the text of the letter as follows:


at the meeting yesterday! It seems as if we’re finally

turning this problem around.

At this point, you decide to cancel the letter again, so you press <Ctrl-c> or <Del>. The system responds with (Interrupt -- one more to kill letter). Because you want to kill the message, press <Ctrl-c> or <Del> a second time; mail quits, and you see the shell prompt.


Previous Table of Contents Next