📄 0176-0179.html
字号:
<HTML>
<HEAD>
<TITLE>Sams Teach Yourself Linux in 24 Hours:Configuring Internet Email:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311623 //-->
<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->
<!-- AUTHOR=Bill Ball//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=11 //-->
<!-- PAGES=0173-0184 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0173-0175.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0180-0182.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-176"><P>Page 176</P></A>
<!-- CODE //-->
<PRE>
# mail
Mail version 5.5-kw 5/30/95. Type ? for help.
"/var/spool/mail/bball": 2 messages
> 1 mwc@savoynet.com Tue Nov 18 10:43 38/2126 "Save on Inkjet /Laser"
2 bball@staffnet.com Tue Nov 18 11:27 24/701 "test"
&
</PRE>
<!-- END CODE //-->
<P>The mail program will retrieve your mail from the
/var/spool/mail directory, print its version, then list each message, and present the ampersand
(&) as a prompt. Note that the current message is preceded by a right angle bracket (greater-than sign). The basic
mail commands are
</P>
<UL>
<LI> t—Type, or list, the current message
<LI> n—Go to the next message and list it
<LI> +—Move to next message and list it
<LI> -—Move backward to previous message and list it
<LI> h—Reprint list of messages (after listing a message)
<LI> d—Delete current message
<LI> R—Reply to sender
<LI> r—Reply to sender and all recipients
<LI> q—Quit, saving messages in the default mailbox, mbox
<LI> x—Quit, don't save messages in mbox
</UL>
<P>One handy way to send a long message quickly is to use the command-line
redirection operator of your shell. For example, if you have composed a long message in your
favorite text editor, you can send the message with
</P>
<!-- CODE SNIP //-->
<PRE>
# mail -s "How is it going?" myfriend@somewhere.com < mymessage.txt
</PRE>
<!-- END CODE SNIP //-->
<P>Using this approach, the mail program will create a message with a subject you specify
with the -s option (note that you must enclose the text with quote marks), and then put the
file mymessage.txt into the body of the message. Be careful, though, because the message will
be sent right away without asking you if you really want to send it.
</P>
<P>There are many more commands and different ways to use the
mail program, and you may find it useful. See the
mail manual page for more information. Although using
mail can be quick and convenient, the next two mail programs are a lot more interactive, and
offer features most people have become accustomed to when they send and receive mail.
</P>
<H4><A NAME="ch11_ 9">
Configuring and Using the pine Mail Program
</A></H4>
<P>The pine mail program, which you'll find under the
/usr/bin directory, was developed by the University of Washington as an interactive mail and news reader. This means that not
only can you use pine for sending or reading your mail, but you can also use it to read
Usenet
</P>
<A NAME="PAGENUM-177"><P>Page 177</P></A>
<P>
newsgroups. Usenet and different news readers are discussed later in this hour, but
this section focuses on configuring and using pine for mail.
</P>
<P>The pine program also comes with an extremely easy-to-use editor called
pico, which might easily become your favorite Linux text editor, because it can be used with any
other program, and not just pine. See Hour 14, "Text Processing," for more details about the
pico editor.
</P>
<P>The pine program is easy to set up and use. Most of the work is done for you
automatically when you first start the program, for example:
</P>
<!-- CODE SNIP //-->
<PRE>
# pine
Creating subdirectory "/home/bball/mail" where Pine will store
its mail folders.
</PRE>
<!-- END CODE SNIP //-->
<P>The pine program starts up and creates a directory called
mail, along with a .pinerc configuration file in your home directory. Before you start composing or sending mail,
you should configure pine to recognize your username, your ISP's mail server, and, as you'll
see later on, your ISP's news server. Although you can compose mail, and use
pine's postpone feature to save your composed messages, you won't be able to send mail until you tell
pine who you are, or the name of your ISP's mail server.
</P>
<P>To do this, type an s, then a c to get to pine's configuration screen (see Figure 11.1).
</P>
<P>Enter your personal name, the domain of your ISP, the name of your ISP's mail
server, and if you know it, the name of your ISP's news server. Then type an
e, and pine will ask if you want to save the changes. Your configuration will then be saved in the
.pinerc file in<BR>
</P>
<P>Figure 11.1<BR>
Specifying the personal<BR>
name, user domain,<BR>
SMTP server,and<BR>
NNTP server in the<BR>
pine mailer configu-<BR>
ration screen.<BR>
</P>
<P><a href="javascript:displayWindow('images/ch11fg01.jpg', 288, 216)"><img src="images/tn_ch11fg01.jpg"></a><BR>
</P>
<A NAME="PAGENUM-178"><P>Page 178</P></A>
<P>your home directory. Although you can edit this file in your favorite text editor, using
pine is a lot easier.
</P>
<P>To compose a message, press the c key, and you'll be in
pine's compose mode (see Fig-<BR>
ure 11.2).
</P>
<P>You can specify multiple recipients to your message by typing a comma between
names. You can also send file attachments by typing the name of the file (if it is in your
home </P>
<P>Figure 11.2.<BR>
Composing a mail<BR>
message with file<BR>
attachments to multiple<BR>
recipients in the pine<BR>
compose mode.</P>
<P><a href="javascript:displayWindow('images/ch11fg02.jpg', 288, 216)"><img src="images/tn_ch11fg02.jpg"></a><BR>
</P>
<P>directory), or the complete path of your file if it is somewhere else on your filesystem.
</P>
<P>As you compose your message, you can use your cursor keys to move around the text,
and a number of editing keys to write your text. You can also delete or undelete lines of
text for cutting and pasting. For more details on editing, see the
pico manual page.
</P>
<P>When you're finished composing your message, you can send the message right away
by using Ctrl+X, or postpone the message by using Ctrl+O. Using this approach, you
can create or reply to messages while you're not connected to your ISP, and then send
them later on.
</P>
<P>When you retrieve your mail, pine will look in the
/var/spool/mail directory, then extract the messages and put them into the default folder, INBOX, in the mail folder in your
home directory (see Figure 11.3). You can also create other folders, and save and delete
messages in different folders to organize your mail. Of course, you can also use the
procmail approach discussed in the section "Configuring
procmail and Writing Recipes to Fight Spam" to
</P>
<A NAME="PAGENUM-179"><P>Page 179</P></A>
<P>
automate some of this process for you.
</P>
<P>Figure 11.3.<BR>
You can select messages<BR>
through pine's<BR>
message list of a pine<BR>
mail folder.</P>
<P><a href="javascript:displayWindow('images/ch11fg03.jpg', 288, 216)"><img src="images/tn_ch11fg03.jpg"></a><BR>
</P>
<P>The folder index of your messages is displayed in a list, and you can select messages
by scrolling up and down with the cursor keys. From the main list of messages, you can
delete, undelete, save, read, and export messages to your directory. To read a message, just
hit the Enter key.
</P>
<P>The pine program has a number of command-line options, and other features, such as
built-in help, which you access with the question mark
(?) from pine's main menu. Other pine functions, such as reading news, are discussed later in this hour.
</P>
<H4><A NAME="ch11_ 10">
Configuring and Using the elm Mail Program
</A></H4>
<P>The elm program, which is more than 10 years old, was originally developed by Dave
Taylor, and has features of the mail and pine programs. You can, as in
mail, send a message from the command line, using the
mail command example you saw earlier, for example:
</P>
<!-- CODE SNIP //-->
<PRE>
# elm -s "How is it going?" bball@staffnet.com < author.msg
Sending mail...
Mail sent!
</PRE>
<!-- END CODE SNIP //-->
<P>When you first start elm, you'll be asked if you want to create
elm's default mail folder, Mail.
</P>
<!-- CODE //-->
<PRE># elm
Notice:
ELM requires the use of a folders directory to store your mail folders in.
Shall I create the directory /home/bball/Mail for you (y/n/q)? y
</PRE>
<!-- END CODE //-->
<P><CENTER>
<a href="0173-0175.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0180-0182.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -