0113-0115.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 391 行
HTML
391 行
<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="0109-0112.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0116-0118.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-113"><P>Page 113</P></A>
<P>is scattered throughout the file, you might forget to change it in some places. Also, if
important information is centralized, you can comment it extensively in a single place. Because
configuration files tend to be obscure at best, a liberal dose of comments is a good antidote to
that sinking feeling you get when, six months later, you wonder why you made a change.
</P>
<H4><A NAME="ch07_ 23">
The H Operator—Header Definitions
</A></H4>
<P>You probably won't want to change the header definitions given in
the V8 sendmail configuration files because they already follow accepted standards. Here are some sample headers:
</P>
<!-- CODE SNIP //-->
<PRE>
H?D?Date: $a
H?F?Resent-From: $q
H?F?From: $q
H?x?Full-Name: $x
</PRE>
<!-- END CODE SNIP //-->
<P>Note that header definitions can use macros, which are expanded, when inserted into a
letter. For example, the $x macro used in the preceding
Full-Name: header definition expands to the full name of the sender.
</P>
<P>The optional ?mailerflag? construct tells
sendmail to insert a header only if the chosen
mailer has that mailer flag set. (See "The M Operator—Mailer Definitions" later in this chapter.)
</P>
<P>Suppose that the definition of your local mailer has a flag
Q, and sendmail selects that mailer to deliver a letter. If your configuration file contains a header definition like the following
one, sendmail will insert that header into letters delivered through the local mailer, substituting
the value of the macro $F:
</P>
<!-- CODE SNIP //-->
<PRE>
H?Q?X-Fruit-of-the-day: $F
</PRE>
<!-- END CODE SNIP //-->
<P>Why would you use the ?mailerflag? feature? Different protocols can require different
mail headers. Because they also need different mailers, you can define appropriate mailer flags
for each in the mailer definition and use the
?mailerflag? construct in the header definition to tell
sendmail whether to insert the header.
</P>
<H4><A NAME="ch07_ 24">
The O Operator—Setting Options
</A></H4>
<P>sendmail has many options that change its operation or tell it the location of files it uses.
Most of them can be given either on the command line or in the configuration file. For example,
you can specify the location of the aliases file in either place. To specify the aliases file on the
command line, you use the -o option:
</P>
<!-- CODE SNIP //-->
<PRE>
$ sendmail -oA/etc/aliases [other arguments...]
</PRE>
<!-- END CODE SNIP //-->
<P>To do the same thing in the configuration file, you include a line like this:
</P>
<!-- CODE SNIP //-->
<PRE>
OA/etc/aliases
</PRE>
<!-- END CODE SNIP //-->
<P>Either use is equivalent, but options such as the location of the aliases file rarely change,
and most people set them in sendmail.cf. The V8
sendmail options are fully described in the SIOG.
</P>
<A NAME="PAGENUM-114"><P>Page 114</P></A>
<H4><A NAME="ch07_ 25">
The P Operator—Mail Precedence
</A></H4>
<P>Users can include mail headers indicating the relative importance of their mail, and
sendmail can use those headers to decide the priority of competing letters.
Precedences for V8 sendmail are given as follows:
</P>
<!-- CODE SNIP //-->
<PRE>
Pspecial-delivery=100
Pfirst-class=0
Plist=-30
Pbulk=-60
Pjunk=-100
</PRE>
<!-- END CODE SNIP //-->
<P>If users who run large mailing lists include the header
Precedence: bulk in their letters, sendmail gives them a lower priority than letters with the header
Precedence: first-class.
</P>
<H4><A NAME="ch07_ 26">
The V Operator—sendmail.cf Version Levels
</A></H4>
<P>As V8 sendmail evolves, its author adds new features. The
V operator lets V8 sendmail know what features it should expect to find in your configuration file. Older versions of
sendmail don't understand this command. The SIOG explains the different configuration file
version levels in detail.
</P>
<CENTER>
<TABLE BGCOLOR="#FFFF99">
<TR><TD><B>
NOTE
</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
The configuration file version level does not correspond to the
sendmail version level. V8 sendmail understands versions 1 through 5 of configuration files, and no such thing as
a version 8 configuration file exists.
</BLOCKQUOTE></TD></TR>
</TABLE></CENTER>
<H4>
The K Operator—Key Files
</H4>
<P>sendmail has always used keyed databases—for example, the aliases databases. Given the
key postmaster, sendmail looks up the data associated with that key and returns the names of
the accounts to which the postmaster's mail should be delivered. V8
sendmail extends this concept to arbitrary databases, including NIS maps (Sun's Network Information Service, formerly
known as Yellow Pages or YP; see Chapter 13 for details). The
K operator tells sendmail the location of the database, its class, and how to access it. V8
sendmail supports the following classes of user-defined databases:
dbm, btree, hash, and NIS. The default used when compiling under Linux
is the dbm format. See the SIOG for the lowdown on key files.
</P>
<H4><A NAME="ch07_ 27">
The M Operator—Mailer Definitions
</A></H4>
<P>Mailers are either MTAs or final delivery agents. Recall that the aliases file allows you to
send mail to a login name (which might be aliased to a remote user), a
program, or a file. A special mailer can be defined for each purpose. And even though the SMTP MTA is built
in, it must have a mailer definition to tailor
sendmail's SMTP operations.
</P>
<A NAME="PAGENUM-115"><P>Page 115</P></A>
<P>Mailer definitions are important because all recipient addresses must resolve to a mailer in
ruleset 0. Resolving to a mailer is just another name for
sendmail's main function, mail routing. For example, resolving to the local mailer routes the letter to a local user via the final delivery
agent defined in that mailer (such as /bin/mail) and resolving to the SMTP mailer routes the
letter to another host via sendmail's built-in SMTP transport, as defined in the SMTP mailer. A
concrete example of a mailer definition will make this information clearer. Because
sendmail requires a local mailer definition, look at the following:
</P>
<!-- CODE SNIP //-->
<PRE>
Mlocal, P=/bin/mail, F=lsDFMfSn, S=10, R=20, A=mail -d $u
</PRE>
<!-- END CODE SNIP //-->
<P>All mailer definitions begin with the M operator and the name of the mailer—in this case,
local. Other fields follow, separated by commas. Each field consists of a field name and
its value, separated by an equal sign (=). The allowable fields are explained in section 5.1.4 of
the SIOG.
</P>
<P>In the preceding local mailer definition, the
P= equivalence gives the pathname of the program to run to deliver the mail,
/bin/mail. The F= field gives the sendmail flags for the local
mailer. (See also "The H Operator—Header Definitions" earlier in the chapter.) These flags are
not passed to the command mentioned in the P= field but are used by
sendmail to modify its operation depending on the mailer it chooses. For example,
sendmail usually drops its superuser status before invoking mailers, but you can use the
S mailer flag to tell sendmail to retain this
status for certain mailers.
</P>
<P>The S= and R= fields specify rulesets for
sendmail to use in rewriting sender and recipient
addresses. Because you can give different R= and
S= flags for each mailer you define, you can rewrite addresses differently for each mailer. For example, if one of your UUCP neighbors
runs obsolete software that doesn't understand domain addressing, you might declare a special
mailer just for that site and write mailer-specific rulesets to convert addresses into a form its
mailer could understand.
</P>
<P>The S= and R= fields can also specify different rulesets to rewrite the envelope and header
addresses. (See "Header and Envelope Addresses" earlier in this chapter.) A specification like
S=21/31 tells sendmail to use ruleset 21 to rewrite sender envelope addresses and ruleset 31
to rewrite sender header addresses. This capability comes in handy for mailers that require
addresses to be presented differently in the envelope and the headers.
</P>
<P>The A= field gives the argument vector (command line) for the program that will be
run—in this case, /bin/mail. In this example,
sendmail runs the command as mail -d $u, expanding the
$u macro to the name of the user to whom the mail should be delivered:
</P>
<!-- CODE SNIP //-->
<PRE>
/bin/mail -d joe
</PRE>
<!-- END CODE SNIP //-->
<P>You could type this exact same command to your shell at a command prompt.
</P>
<P>You might want to use many other mailer flags to tune mailers—for example, to limit
the maximum message size on a per-mailer basis. These flags are all documented in section
5.1.4 of the SIOG.
</P>
<P><CENTER>
<a href="0109-0112.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0116-0118.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?