0097-0100.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 353 行

HTML
353
字号




<HTML>

<HEAD>

<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:SMTP and POP</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=0672311739 //-->

<!-- TITLE=RED HAT LINUX 2ND EDITION //-->

<!-- AUTHOR=DAVID PITTS ET AL //-->

<!-- PUBLISHER=MACMILLAN //-->

<!-- IMPRINT=SAMS PUBLISHING //-->

<!-- PUBLICATION DATE=1998 //-->

<!-- CHAPTER=07 //-->

<!-- PAGES=0097-0130 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="../ch06/0094-0096.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0101-0102.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-97"><P>Page 97</P></A>











<H3><A NAME="ch07_ 1">

CHAPTER 7

</A></H3>













<H2>



SMTP and POP



</H2>









<B>

by Jeff Smith, Chris Byers, and Steve

Shah

</B>









<H3><A NAME="ch07_ 2">

IN THIS CHAPTER

</A></H3>









<UL>

<LI>     SMTP 98

<LI>     POP 124

</UL>



<A NAME="PAGENUM-98"><P>Page 98</P></A>









<P>Electronic mail (e-mail) is arguably the most used application of any data network such as

the Internet. (Yes, even more so than the World Wide Web!) Early in the Internet's life, there

were many proposed standards for e-mail between systems. These standards changed often, and

the corresponding software changes were significant.

</P>









<P>During this time of rapid change in e-mail protocols, a package emerged as a standard for

mail transfer&#151;sendmail. sendmail, written by Eric Allman of UC Berkeley, was an unusual

program for its time because it thought of the e-mail problem in a different light. Instead of

rejecting e-mail from different networks using so-called incorrect protocols, it massaged the

message and fixed it so that the message could be passed on to its destination. The side effect of

this level of configurability has been complexity. Several books have been written on the

subject (the authoritative texts have reached over 1000 pages); however, for most administrators

those are overkill.

</P>









<P>One of the key features of sendmail that differentiated it from other

mail transfer agents (MTAs) during the '80s was the separation of mail routing, mail delivery, and mail readers.

sendmail performed mail routing functions only, leaving delivery to local agents that the

administrator could select. This also allowed users to select their preferred mail readers as long as they

could read the format of the messages written by the delivery software.

</P>









<P>With the advent of larger heterogeneous networks, the need for

mail readers that worked on network clients and connected to designated mail servers to send and receive mail gave way

to the Post Office Protocol (POP). POP mail readers have since flourished with client

software available for every imaginable platform and server software available for not only various

implementations of UNIX (including Linux) but for other less robust operating systems as well.

</P>









<P>This chapter covers the most recent work on

sendmail, its underlying protocol SMTP, and the

qpopper package which implements POP support for Linux.

</P>









<H3><A NAME="ch07_ 3">

SMTP

</A></H3>









<P>The Simple Mail Transfer Protocol (SMTP) is the established standard way

of transferring mail over the Internet. The

sendmail program provides the services needed to support SMTP

connections for Linux.

</P>









<P>This section covers the various details needed to understand the

sendmail package, install it, and configure it. Before getting into the details, however, I'll take a moment to discuss

the SMTP protocol in better detail and how the Domain Name System (DNS) (see Chapter

13, &quot;TCP/IP Network Management,&quot; for details on DNS configuration) interacts with e-mail

across the Internet.

</P>









<P>Armed with a better understanding of the protocols, you can take on understanding

sendmail itself beginning with the various tasks that

sendmail performs (such as mail routing, header rewriting, and so on) as well as its corresponding configuration files.

</P>



<A NAME="PAGENUM-99"><P>Page 99</P></A>







<CENTER>

<TABLE BGCOLOR="#FFFF99">

<TR><TD><B>

WARNING

</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

As with any large software package, sendmail has its share of bugs. Although the bugs

that cause sendmail to fail or crash the system have been almost completely eliminated,

security holes that provide root access are still found from time to time.

<BR>

Like any software that provides network connectivity, you

must keep track of security announcements from the

Computer Emergency Response Team (CERT,

www.cert.org) by either visiting its Web page, joining its mailing list, or reading its moderated

newsgroup comp.security.announce.

</BLOCKQUOTE></TD></TR>

</TABLE></CENTER>

<H4>

Internet Mail Protocols

</H4>









<P>To understand the different jobs that sendmail performs, you need to know a little about

Internet protocols. Protocols are simply agreed-upon standards that software and hardware

use to communicate.

</P>









<P>Protocols are usually layered, with higher levels using the lower ones as building blocks.

For example, the Internet Protocol (IP) sends packets of data back and forth without building

an end-to-end connection such as used by SMTP and other higher-level protocols. The

Transmission Control Protocol (TCP), which is built on top of IP, provides for

connection-oriented services such as those used by programs such as Telnet and the Simple Mail Transfer

Protocol (SMTP). Together, TCP/IP provides the basic network services for the Internet.

Higher-level protocols such as the File Transfer Protocol (FTP) and SMTP are built on top of TCP/IP.

The advantage of such layering is that programs which implement the SMTP or FTP protocols

don't have to know anything about transporting packets on the network and making connections

to other hosts. They can use the services provided by TCP/IP for that job.

</P>









<P>SMTP defines how programs exchange e-mail on the Internet. It doesn't matter whether

the program exchanging the e-mail is sendmail running on an HP workstation or an SMTP

client written for an Apple Macintosh. As long as both programs implement the SMTP

protocol correctly, they can exchange mail.

</P>









<P>The following example of the SMTP protocol in action might help demystify it a little.

The user betty at gonzo.gov is sending mail to joe at

whizzer.com:

</P>





<!-- CODE //-->

<PRE>

$ sendmail -v joe@whizzer.com &lt; letter

joe@whizzer.com... Connecting to whizzer.com via tcp...

Trying 123.45.67.1...  connected.

220-whizzer.com SMTP ready at Mon, 6 Jun 1997 18:56:22 -0500

220 ESMTP spoken here

&gt;&gt;&gt; HELO gonzo.gov

250 whizzer.com Hello gonzo.gov [123.45.67.2], pleased to meet you

&gt;&gt;&gt; MAIL From:&lt;betty@gonzo.gov&gt;

250 &lt;betty@gonzo.gov&gt;... Sender ok

&gt;&gt;&gt; RCPT To:&lt;joe@whizzer.com&gt;

</PRE>

<!-- END CODE //-->





<A NAME="PAGENUM-100"><P>Page 100</P></A>





<!-- CODE //-->

<PRE>

250 &lt;joe@whizzer.com&gt;... Recipient ok

&gt;&gt;&gt; DATA

354 Enter mail, end with &quot;.&quot; on a line by itself

&gt;&gt;&gt; .

250 SAA08680 Message accepted for delivery

&gt;&gt;&gt; QUIT

221 whizzer.com closing connection

joe@whizzer.com... Sent

$

</PRE>

<!-- END CODE //-->











<P>The first line shows one way to invoke sendmail directly rather than let your favorite

Mail User Agent (MUA) such as Elm, Pine, or Mutt do it for you. The

-v option tells sendmail to be verbose and shows you the SMTP dialogue. The other lines show an SMTP client and

server carrying on a conversation. Lines prefaced with

&gt;&gt;&gt; indicate the client (or sender) on

gonzo.gov, and the lines that immediately follow are the replies of the server (or receiver) on

whizzer.com. The first line beginning with 220 is the SMTP server announcing itself after the initial

connection, giving its hostname and the date and time, and the second line informs the client that

this server understands the Extended SMTP protocol (ESMTP) in case the client wants to use

it. Numbers such as 220 are reply codes that the SMTP client uses to communicate with the

SMTP server. The text following the reply codes is only for human consumption.

</P>









<P>Although this dialogue might still look a little mysterious, it will soon be very familiar if

you take the time to read RFC 821. Running

sendmail with its -v option also helps you understand how an SMTP dialogue works.

</P>









<H4><A NAME="ch07_ 4">





The Domain Name System and E-mail

</A></H4>









<P>Names like whizzer.com are convenient for humans, but computers insist on using numeric

IP addresses like 123.45.67.1. The Domain Name System (DNS) provides this hostname to

IP address translation and other important information.

</P>









<P>In the old days when most of us walked several miles to school through deep snow, there

were only a few thousand hosts on the Internet. All hosts were registered with the

Network Information Center (NIC), which distributed a host table listing the hostnames and IP addresses

of all the hosts on the Internet. Those simple times are gone forever. No one really knows

how many hosts are connected to the Internet now, but they number in the millions, and an

administrative entity like the NIC can't keep their names straight. Thus was born the DNS.

</P>









<P>The DNS distributes authority for naming and numbering hosts to autonomous

administrative domains. For example, a company called

whizzer.com could maintain all the information about the hosts in its own domain. When the host

a.whizzer.com wants to send mail or Telnet to the host

b.whizzer.com, it sends an inquiry over the network to the

whizzer.com nameserver, which might run on a host named

ns.whizzer.com. The ns.whizzer.com nameserver

would reply to a.whizzer.com with the IP address of

b.whizzer.com (and possibly other information), and the mail would be sent or the Telnet connection made. Because

ns.whizzer.com is authoritative for the

whizzer.com domain, it can answer any inquiries about

whizzer.com hosts regardless of where they originate; the authority for naming hosts in this domain has

been delegated.

</P>



<P><CENTER>

<a href="../ch06/0094-0096.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0101-0102.html">Next</A>

</CENTER></P>









</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?