📄 0173-0175.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="../ch10/0170-0172.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0176-0179.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-173"><P>Page 173</P></A>
<H3><A NAME="ch11_ 2">
Hour 11
</A></H3>
<H2>
<A NAME="ch11_ 3">
Configuring Internet Email
</A>
</H2>
<P>This hour shows you how to set up your Linux system to handle
electronic mail. You'll also explore various programs you can use to read and send mail.
</P>
<P>First you'll learn to set up your system to send and receive mail, building
on your experience in setting up and connecting with your ISP using PPP.
</P>
<H3><A NAME="ch11_ 4">
Setting Up and Getting Your Email
</A></H3>
<P>There's not really much to do to set up your system to send and receive
mail, although configuring the main mail daemon,
sendmail, is complex enough to be considered a black art, suitable only for UNIX wizards. You shouldn't
be intimidated though, because you can use email right after you install Linux
and create other users.
</P>
<P>I can't discuss all of the details about UNIX mail in this hour, but you
should understand how electronic mail works in general. The main
programs involved in email are, in technical terms, transport agents and user agents.
A transport agent is a program, usually a daemon, which sends mail files
from one computer to the next automatically. A user
agent is a program, also called a mail reader, which
you use to manage messages.
</P>
<A NAME="PAGENUM-174"><P>Page 174</P></A>
<P>After you install Linux, you'll find all of the programs you need to compose, send,
and receive mail. The transport agent used in Linux is
sendmail, and it is configured and run automatically when you boot the operating system. As far as user agents go, you have
your choice, and they are discussed later in the hour.
</P>
<P>Because you're connecting to the Internet with a PPP connection, the general approach
to handling mail outlined in this hour is to log in and connect, retrieve mail, and
then disconnect (or stay connected for a few quick replies). If you've experimented with
free email account programs for other operating systems, you know the general approach is
to minimize connect time by composing and replying to mail offline, then
connecting, sending and retrieving mail, followed by logging off.
</P>
<P>If you want the details about Linux mail handling, along with pointers to other sources
of information, read Vince Skahan's Mail-HOWTO under the
/usr/doc/HOWTO directory.
</P>
<H4><A NAME="ch11_ 5">
Retrieving Your Email with popclient
</A></H4>
<P>By now you're probably wondering how to get your email from your ISP. If you recall
from the last hour, you should have the IP address or name of your ISP's mail server. To get
your mail, you'll need the popclient program, found in the
/usr/bin directory. You'll also need to know what Post Office Protocol, or POP, your ISP uses, along with your username
and password. Most ISPs support either POP2 or POP3, which are simple protocols
for retrieving your messages.
</P>
<P>Put all this information together, connect to your ISP, and then grab all your waiting
email with one command line:
</P>
<!-- CODE SNIP //-->
<PRE>
# /etc/ppp/ppp-on
# popclient -3 -u username -p password mailserver.yourisp.com
</PRE>
<!-- END CODE SNIP //-->
<P>You can also put this command line into a text file, use
chmod +x, and call it as follows:
</P>
<!-- CODE //-->
<PRE>
# domail
QUALCOMM Pop server derived from UCB (version 2.1.4-R3) at megan starting.
3 messages in folder
reading message 1.
reading message 2.
reading message 3......
</PRE>
<!-- END CODE //-->
<P>The popclient program is designed to work only one way; it retrieves your mail from
your ISP's mail server, then tells your ISP's mail server to delete your mail after it is
received. You can also use other options, such as telling your ISP's mail server to keep copies of
your mail even after you retrieve, or to put your retrieved mail into an optional directory on
your system. By default, your mail will go into a single file with your username under the
/var/spool/mail directory. See the popclient manual page for more options.
</P>
<A NAME="PAGENUM-175"><P>Page 175</P></A>
<H4><A NAME="ch11_ 6">
Using fetchmail as an Alternative
</A></H4>
<P>If you'd like to try an another program instead of
popclient to retrieve your mail, you may want to try
fetchmail. This program offers a few more features, and can run in daemon
mode, checking to see if you have mail while you're connected to your ISP. Using
fetchmail is easy, for example:
</P>
<!-- CODE //-->
<PRE>
# fetchmail -p POP3 staffnet.com
Enter password for bball@staffnet.com:
1 message from bball@staffnet.com.
reading message 1 (581 bytes) flushed
</PRE>
<!-- END CODE //-->
<P>fetchmail will prompt for your password (so you can gain access to your ISP's mail
server), then retrieves your mail and flushes (or deletes) your mail from your ISP's mail
server. fetchmail also has a nifty option, -c, which unlike
popclient's -c option, will merely check to see if you have mail waiting, and report the number of messages. See
fetchmail's manual page for more information.
</P>
<P>Now that you've retrieved your mail, how do you read it, or reply to messages? This is
where user agents, or mail-reading programs, come in.
</P>
<H3><A NAME="ch11_ 7">
Sending Mail with Mail Programs
</A></H3>
<P>This section introduces you to three basic mail programs you can use under Linux.
The explanations start with one of the oldest, the
mail program, then follow with two screen-oriented programs,
pine and elm.
</P>
<H4><A NAME="ch11_ 8">
Using the mail Program
</A></H4>
<P>The mail program, found under the /bin directory, is the simplest mail program
you can use, but it is not screen-oriented. mail can send and receive mail, but you're limited to
working on a line-by-line basis. This program is handy for quick messages and is easy to use.
For example, to create a quick message, call mail with an address on the command line:
</P>
<!-- CODE SNIP //-->
<PRE>
# mail bball@staffnet.com
Subject: Using the mail Program
This is how to use the mail program!
Have fun, and enjoy.
.
EOT
</PRE>
<!-- END CODE SNIP //-->
<P>The mail program will respond by asking for a Subject: line. Enter your text, and then
press the Enter key. Then, type each line of text, and when you're done, put a period (.) on a
line by itself. The mail program will then send the message. Retrieving your messages is
easy. After you connect to your ISP, and retrieve your mail using either
popclient or fetchmail, you can simply type mail on the command line, for example:
</P>
<P><CENTER>
<a href="../ch10/0170-0172.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0176-0179.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -