📄 unx41.htm
字号:
<HTML>
<HEAD>
<TITLE>UNIX Unleashed unx41.htm</TITLE>
<LINK REL="ToC" HREF="index.htm">
<LINK REL="Next" HREF="unx42.htm">
<LINK REL="Previous" HREF="unx40.htm"></HEAD>
<BODY TEXT="#000000" LINK="#0000FF" VLINK="#800080" bgcolor=white>
<P><A HREF="unx40.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="index.htm"><IMG SRC="blutoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="unx42.htm"><IMG SRC="blunext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<A HREF="index.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Home"></A>
</P><UL>
<LI>
<A HREF="#I1">41 — Mail Administration</A></LI>
<UL>
<UL>
<UL>
<UL>
<LI>
<A HREF="#I3">By Jeff Smith</A></LI></UL></UL>
<LI>
<A HREF="#I4">Introduction</A></LI>
<LI>
<A HREF="#I5">Overview & Terminology—E-mail from Point A to Point B</A></LI>
<UL>
<LI>
<A HREF="#I6">Background Material and Other Sources</A></LI>
<UL>
<LI>
<A HREF="#I7">Request for Comments Documents (RFCs)</A></LI>
<LI>
<A HREF="#I8">Sendmail Documentation</A></LI>
<LI>
<A HREF="#I9">sendmail, The Book</A></LI>
<LI>
<A HREF="#I10">Comp.mail.sendmail</A></LI></UL>
<LI>
<A HREF="#I11">Internet Mail Protocols</A></LI>
<LI>
<A HREF="#I12">The Domain Name System (DNS) and E-Mail</A></LI>
<UL>
<LI>
<A HREF="#I13">Mail Delivery and MX Records</A></LI>
<LI>
<A HREF="#I14">Header and Envelope Addresses</A></LI></UL>
<LI>
<A HREF="#I15">sendmail's Jobs</A></LI>
<UL>
<LI>
<A HREF="#I16">sendmail as Mail Router</A></LI>
<LI>
<A HREF="#I17">sendmail as MTA—Client (Sender) and Server (Receiver) SMTP</A></LI>
<LI>
<A HREF="#I18">sendmail as a Final Delivery Agent (NOT!)</A></LI></UL>
<LI>
<A HREF="#I19">sendmail's Auxiliary Files</A></LI>
<LI>
<A HREF="#I20">The Aliases File</A></LI>
<UL>
<LI>
<A HREF="#I21">Reading Aliases from a File—the :include: Directive</A></LI>
<LI>
<A HREF="#I22">Mail to Programs</A></LI>
<LI>
<A HREF="#I23">Mail to Files</A></LI></UL></UL>
<LI>
<A HREF="#I24">Setting up sendmail</A></LI>
<UL>
<LI>
<A HREF="#I25">Obtaining the Source</A></LI>
<LI>
<A HREF="#I26">Unpacking the Source and Compiling sendmail</A></LI></UL>
<LI>
<A HREF="#I27">sendmail.cf—the Configuration File</A></LI>
<UL>
<LI>
<A HREF="#I28">General Form of the Configuration File</A></LI>
<LI>
<A HREF="#I29">A Functional Description of the Configuration File</A></LI>
<LI>
<A HREF="#I30">The D Operator—Macros</A></LI>
<LI>
<A HREF="#I31">The C and F Operators—Classes</A></LI>
<UL>
<LI>
<A HREF="#I32">The H Operator—Header Definitions</A></LI>
<LI>
<A HREF="#I33">The O Operator—Setting Options</A></LI>
<LI>
<A HREF="#I34">The P Operator—Mail Precedence</A></LI>
<LI>
<A HREF="#I35">The V Operator—sendmail.cf Version Levels</A></LI>
<LI>
<A HREF="#I36">The K Operator—Key Files</A></LI>
<LI>
<A HREF="#I37">The M Operator—Mailer Definitions</A></LI>
<LI>
<A HREF="#I38">The S and R Operators—Rulesets and Rewriting Rules</A></LI>
<LI>
<A HREF="#I39">sendmail's Built-In Ruleset Processing Rules</A></LI>
<LI>
<A HREF="#I40">Processing Rules Within Rulesets</A></LI>
<LI>
<A HREF="#I41">Parsing—Turning Addresses into Tokens</A></LI>
<LI>
<A HREF="#I42">The Lefthand Side (lhs) of Rules</A></LI>
<LI>
<A HREF="#I43">The Righthand Side (rhs) of Rules</A></LI>
<LI>
<A HREF="#I44">$: and $@—Altering a Ruleset's Evaluation</A></LI>
<LI>
<A HREF="#I45">$>—Calling Another Ruleset</A></LI>
<LI>
<A HREF="#I46">Testing Rules and Rulesets—the -bt, -d and -C Options</A></LI>
<LI>
<A HREF="#I47">Conclusion</A></LI></UL>
<LI>
<A HREF="#I48">Creating a sendmail.cf</A></LI>
<LI>
<A HREF="#I49">Testing sendmail and sendmail.cf</A></LI>
<LI>
<A HREF="#I50">Installing sendmail and Friends</A></LI>
<UL>
<LI>
<A HREF="#I51">Modifying sendmail's Boot-Time Startup</A></LI></UL></UL>
<LI>
<A HREF="#I52">Summary</A></LI></UL></UL></UL>
<H1 ALIGN="CENTER">
<CENTER><A ID="I1" NAME="I1">
<BR>
<FONT SIZE=5><A ID="I2" NAME="I2"></A><B>41 — Mail Administration</B>
<BR></FONT></A></CENTER></H1>
<H5 ALIGN="CENTER">
<CENTER><A ID="I3" NAME="I3">
<FONT SIZE=3><B>By Jeff Smith</B>
<BR></FONT></A></CENTER></H5>
<H3 ALIGN="CENTER">
<CENTER><A ID="I4" NAME="I4">
<FONT SIZE=4><B>Introduction</B>
<BR></FONT></A></CENTER></H3>
<P>So, they've gone and made you postmaster, have they? Perhaps you're approaching this new job with a little trepidation—and you should. Electronic mail administration is one of the most complex system administration tasks and one of the most
visible. If you break an obscure program that few people use, your mistake may go unnoticed. If you break the mail system, all the users on your system will be affected, and most people consider electronic mail to be one of UNIX's most valuable services.
Even worse, if your site is connected to the Internet, your mistakes may be visible at remote sites, and those sites' postmasters will not hesitate to inform you that while your mother may love you, they consider you and your broken mail system to be
little better than pond scum. (Those are the moderates—others may not be so kind.)
<BR></P>
<P>Still with me? Good. Despite the potential for making mistakes on a grand scale, mail administration at many sites is routine. You probably won't have to fuss with the e-mail system much once you manage to get it up and running, and this chapter helps
you do just that. First, you get a broad overview of how e-mail works, an explanation of some of the terminology you'll see in this and other books, and pointers on where to get more information. Finally, you'll see a step-by-step example of how to set up
the sendmail program and its configuration file, sendmail.cf.
<BR></P>
<P>What this chapter won't do is cover complex configurations like a multiprotocol mail hub that routes mail from the Internet to UUCP or a DECnet network. You won't learn how to set up the Domain Name System (DNS), although a properly working DNS is
essential to the e-mail system. Coverage of UUCP is minimal, and you only learn about one of the many variants of sendmail (version 8, or just V8). Finally, this chapter won't make you into a sendmail guru, but if you're lucky you'll never need to be one.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I5" NAME="I5">
<FONT SIZE=4><B>Overview & Terminology—E-mail from Point A to Point B</B>
<BR></FONT></A></CENTER></H3>
<P>An electronic mail message begins its life as a file on your computer's disk, created by a Mail User Agent (MUA). After you compose the letter, the MUA gives it to a mail router like sendmail. The mail router gives it to a Mail Transport Agent (MTA).
The message traverses one or more hosts and networks and is given to a final delivery agent, which appends it to the recipient's mailbox, another disk file. Each of these terms is explained in detail later in this chapter.
<BR></P>
<P>An MUA is just a fancy name for a mail-reading and -sending program, such as the SVR4 mailx. Other examples of MUAs are elm and the Rand corporation's Mail Handler (MH) programs. An MUA is the only part of the mail system with which users usually
interact, since a good MUA hides the complexity of the rest of the system from them (but not from the postmaster)!
<BR></P>
<P>A mail router is a program that takes a piece of mail and decides where it should go and how to get it there. For instance, depending on the recipient, a letter might need to travel over a TCP/IP network using the Simple Mail Transfer Protocol (SMTP),
or via a dial-up connection using the UNIX to UNIX Copy (UUCP) protocol, or even to an office fax machine. The mail router uses the recipient address and its own internal configuration information to decide the best MTA, and then hands the letter to the
MTA.
<BR></P>
<P>An MTA is a transport program that understands the e-mail protocols of a particular network and can transport a letter over that network. For instance, the UUCP transport agents understand UUCP protocols but know nothing about SMTP. If the mail router
were to mistakenly route an SMTP letter to a UUCP transport agent, it wouldn't know how to deliver it.
<BR></P>
<P>The final delivery agent does nothing but take a mail message and append it to the recipient's mailbox, following whatever local conventions are used to separate messages within a mailbox. The program /bin/mail is the usual final delivery agent on SVR4
systems.
<BR></P>
<P>In real life the distinctions between MTAs and MUAs and mail routers are sometimes blurred. For instance, sendmail, although primarily a mail router, can also function as an MTA because it understands the SMTP protocol and can transport mail over a
TCP/IP network. Therefore, in Figure 41.1 the separate functions of mail router and MTA are really a single program. Further, the SMTP-server part of the remote end of the MTA is often another sendmail program, which may do additional routing and
forwarding of the mail before it reaches its final delivery agent. Some MUAs even do their own mail routing, and some, like MH, can be configured to speak SMTP, an MTA function. Despite this real-world blurring of function, the conceptual framework
outlined above is a good one to keep in mind.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I6" NAME="I6">
<FONT SIZE=3><B>Background Material and Other Sources</B>
<BR></FONT></A></CENTER></H4>
<P>E-mail administration is a complex endeavor. This chapter gives you enough background to get you out of the gate and running, but you must carefully study the following materials to really understand what you're doing. It's a lot better to learn it
now—with a warm cup of cocoa in hand—than to wait until you've got a dozen angry users in your office demanding that you fix the mail system immediately. Trust me on this one.
<BR></P>
<P>Don't worry if some of the documents mentioned below don't make sense on a first reading; you don't have to understand every little clause of RFC 822 (described in the next section) to be a successful postmaster, and if you persevere you'll understand
as much as you need to know at first. After you gain some experience, you'll re-read them and understand them even better.
<BR></P>
<H5 ALIGN="CENTER">
<CENTER><A ID="I7" NAME="I7">
<FONT SIZE=3><B>Request for Comments Documents (RFCs)</B>
<BR></FONT></A></CENTER></H5>
<P>RFCs are issued by working groups of the Internet Engineering Task Force (IETF). They are known initially as a request for comments, but as they are adopted as Internet standards, you should think of them as requirements for compliance. So if you want
to exchange e-mail with another site on the Internet, you must comply with the provisions of both RFCs 821 and 822. RFCs are available for anonymous ftp on the host ftp.internic.net. The RFCs mentioned below are also on the UNIX Unleashed CD-ROM.
<BR></P>
<UL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -