⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 525-527.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Special Edition Using Linux, Fourth Edition:Configuring Electronic Mail</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=0789717468//-->

<!--TITLE=Special Edition Using Linux, Fourth Edition//-->

<!--AUTHOR=Jack Tackett//-->

<!--AUTHOR=Jr.//-->

<!--AUTHOR=Steve Burnett//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--CHAPTER=26//-->

<!--PAGES=525-527//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="523-525.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="527-529.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P><FONT SIZE="+1"><B>sendmail the Daemon</B></FONT></P>

<P>sendmail itself is normally configured to run on a UNIX system as a <I>daemon</I> in order to listen for incoming mail.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>A daemon is a UNIX system program that runs in the background without a controlling terminal window.<HR></FONT>

</BLOCKQUOTE>

<P>When run as a daemon, unless it&#146;s instructed not to on startup, <TT>sendmail</TT> forks and runs in the background, listening on socket 25 for incoming SMTP connections. The command to run <TT>sendmail</TT> as a daemon on a Berkeley UNIX-based system might look something like this:</P>

<!-- CODE SNIP //-->

<PRE>

/usr/lib/sendmail -bd -q30m

</PRE>

<!-- END CODE SNIP //-->

<P>This command can be defined as one of the startup commands executed when the UNIX system boots. Here is a sample of a command, taken from a startup script named sendmail.init found in the /etc/rc.d/init.d directory on a Linux system:

</P>

<!-- CODE SNIP //-->

<PRE>

# Start daemons.

echo -n "Starting sendmail: "

daemon sendmail -bd -q1h

echo

touch /var/lock/subsys/sendmail

;;

</PRE>

<!-- END CODE SNIP //-->

<P>The <TT>-bd</TT> flag launches <TT>sendmail</TT> as a daemon and the <TT>-q1h</TT> switch instructs <TT>sendmail</TT> to check the queue once every hour. In contrast, the sample command preceding this one has the <TT>-q</TT> switch instructing <TT>sendmail</TT> to check the queue every thirty minutes.</P>

<P>The first action <TT>sendmail</TT> takes when it&#146;s started is to read the /etc/sendmail.cf configuration file. The sendmail.cf and dependent configuration files are presented in the next section.</P>

<P><FONT SIZE="+1"><B>sendmail Configuration and Control Using the sendmail.cf File</B></FONT></P>

<P>Part of sendmail&#146;s power is derived from the access provided to sendmail&#146;s underlying configuration files. As mail messages are funneled through sendmail&#146;s configuration files, sendmail performs all message routing functions, including parsing, forwarding, delivering, returning, and queuing.

</P>

<P>The core of sendmail&#146;s configuration is the sendmail.cf file. A complex configuration file read only once at <TT>sendmail</TT>&#146;s initial run time, sendmail.cf contains three important types of information:</P>

<DL>

<DD><B>&#149;</B>&nbsp;&nbsp;Options such as operational control switches, mailer definitions, and the locations of other sendmail sub-configuration files

<DD><B>&#149;</B>&nbsp;&nbsp;Macros for use in rulesets

<DD><B>&#149;</B>&nbsp;&nbsp;Rulesets for rewriting addresses on incoming and outgoing messages

</DL>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>NOTE:&nbsp;&nbsp;</B>No one bothers to write a sendmail.cf file starting with a blank page in a text editor. If you are configuring sendmail for a new network, you can almost certainly find a sendmail.cf file that requires minimal changes. Of course, after you have a functioning mailserver, make a backup of the working configuration and put it somewhere safe.<HR></FONT>

</BLOCKQUOTE>

<P>V8 sendmail added the use of the m4 macro <TT>preprocesso</TT>, which is used to generate sendmail.cf files containing the features you select. A sendmail m4 creation file typically should be given a .mc (macro configuration) file suffix, but this is not required for the process to work. Many sample .mc scripts are supplied with the standard sendmail distributions.</P>

<P>For example, a minimum .mc file for a Linux workstation (without appropriate comments) could be something like this:</P>

<!-- CODE SNIP //-->

<PRE>

OSTYPE(linux)dnl

MAILER(local)dnl

</PRE>

<!-- END CODE SNIP //-->

<P>These two are the only two required macros in a .mc file. You are likely to want more features, but this file&#151;named smallest_linux.mc&#151;could be run with the following command (assuming you are in the /usr/lib/sendmail/cf/cf directory, which is where the standard sendmail distribution places m4 files):

</P>

<!-- CODE SNIP //-->

<PRE>

m4 ../m4/cf.m4 smallest_linux.mc &gt; sendmail.cf

</PRE>

<!-- END CODE SNIP //-->

<P>The following list provides a breakdown of the elements in the preceding command:

</P>

<CENTER>

<TABLE WIDTH="90%"><TR>

<TD WIDTH="40%"><TT>m4</TT>

<TD WIDTH="60%">Calls the m4 preprocessor

<TR>

<TD><TT>../m4/cf.m4</TT>

<TD>Identifies m4&#146;s default configuration file

<TR>

<TD><TT>smallest_linux.mc</TT>

<TD>Is the two-line macro configuration file

<TR>

<TD VALIGN="TOP"><TT>&gt;sendmail.cf</TT>

<TD>Specifies that output is to be placed in the sendmail.cf file

</TABLE>

</CENTER>

<P>Now that you have used m4 to generate a sendmail.cf file containing exactly the features you requested, you will still need to customize the sendmail.cf file for use at your site. Using m4 for sendmail.cf generation, however, is fast and accurate. In addition to using the many m4 macros that ship with the sendmail distribution, you can also write your own as you feel necessary and include them for use.

</P>

<P>For a quick sendmail configuration file, fill out the World Wide Web form interface to the m4 configuration tool (for V8 sendmail) at <A HREF="http://www.completeis.com/sendmail/sendmail.cgi">http://www.completeis.com/sendmail/sendmail.cgi</A>. Select your desired options with the Web form, and a sendmail.cf file with the chosen options will be returned to you.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="523-525.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="527-529.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





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

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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