📄 unx41.htm
字号:
Makefile.ConvexOS Makefile.dist parseaddr.c
Makefile.DGUX READ_ME pathnames.h
Makefile.Dell TRACEFLAGS queue.c
Makefile.DomainOS alias.c readcf.c
Makefile.Dynix aliases recipient.c
Makefile.FreeBSD aliases.5 savemail.c
Makefile.HP-UX arpadate.c sendmail.8
Makefile.IRIX cdefs.h sendmail.h
Makefile.Linux clock.c sendmail.hf
Makefile.Mach386 collect.c srvrsmtp.c
Makefile.NCR3000 conf.c stab.c
Makefile.NeXT conf.h stats.c
Makefile.NetBSD convtime.c sysexits.c
Makefile.OSF1 daemon.c trace.c
Makefile.RISCos deliver.c udb.c
Makefile.SCO domain.c useful.h
Makefile.SVR4 envelope.c usersmtp.c
Makefile.Solaris err.c util.c
Makefile.SunOS headers.c version.c
Makefile.SunOS.4.0.3 macro.c</PRE>
<P>As you can see, because sendmail runs on a variety of hosts and operating systems, a Makefile is provided for many UNIX variants. Since in this example we're assuming a Sun Microsystems Solaris system, we'll use Makefile.Solaris to compile sendmail. But
before we type make, we should look at the files conf.h and Makefile.Solaris.
<BR></P>
<P>You probably won't want to change much in conf.h, but Makefile.Solaris is a different story. At the very least you should make sure that the correct version of the Solaris operating system is defined. In this case, since we're compiling for Solaris 2.3,
we must replace the line ENV=-DSOLARIS with the line ENV=-DSOLARIS_2_3 (Makefile.Solaris tells us to do so). If you've purchased the SunPro cc compiler, you may want to change the definition of the CC macro to use that instead of gcc. You may want to make
other changes; for example, you may not want to install sendmail in the default location. Read the Makefile carefully and make changes as needed.
<BR></P>
<P>Remember, when in doubt, you can always type make -n <I>arguments</I> to see what would happen before it happens. This is always an especially good idea when you're working as the super-user.
<BR></P>
<P>Now you're ready to compile. Type:
<BR></P>
<PRE>$ make -f Makefile.Solaris sendmail
gcc -I. -I/usr/sww/include/db -DNDBM -DNIS -DSOLARIS_2_3 -c alias.c
[...]
gcc -I. -I/usr/sww/include/db -DNDBM -DNIS -DSOLARIS_2_3 -c util.c
gcc -I. -I/usr/sww/include/db -DNDBM -DNIS -DSOLARIS_2_3 -c version.c
gcc -o sendmail alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o
deliver.o domain.o envelope.o err.o headers.o macro.o main.o map.o mci.o
parseaddr.o queue.o readcf.o recipient.o savemail.o srvrsmtp.o stab.o stats.o
sysexits.o trace.o udb.o usersmtp.o util.o version.o
-L/usr/sww/lib -lresolv -lsocket -lnsl -lelf</PRE>
<P>The [...] above covers many deleted lines of output, as well as some warning messages from the compiler. Carefully inspect the output and determine whether the compiler warnings are pertinent. If necessary (and it should only be necessary if you're
porting sendmail to a new architecture), correct any problems and compile again.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I27" NAME="I27">
<FONT SIZE=4><B><I>sendmail.cf</I></B><B>—the Configuration File</B>
<BR></FONT></A></CENTER></H3>
<P>Now you've got a working sendmail, but like the Wizard of Oz's Scarecrow, it's brainless. The sendmail.cf file provides sendmail with its brains, and because it's so important, we're going to cover it in fairly excruciating detail. Don't worry if you
don't understand everything in this section the first time through. It will make more sense upon rereading, and after you've had a chance to play with some configuration files of your own.
<BR></P>
<P>sendmail's power lies in its flexibility, which comes from its configuration file, sendmail.cf. sendmail.cf statements comprise a cryptic programming language that at first glance doesn't inspire much confidence (but C language code probably didn't
either the first time you saw it). However, learning the sendmail.cf language isn't that hard, and you won't have to learn the nitty-gritty details unless you plan to write a sendmail.cf from scratch—a bad idea at best. You do need to learn enough to
understand and adapt the V8 sendmail configuration file templates to your site's needs.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I28" NAME="I28">
<FONT SIZE=3><B>General Form of the Configuration File</B>
<BR></FONT></A></CENTER></H4>
<P>Each line of the configuration file begins with a single command character that tells the function and syntax of that line. Lines beginning with a # are comments, and blank lines are ignored. Lines beginning with a space or tab are a continuation of the
previous line, although you should usually avoid continuations.
<BR></P>
<P>Table 41.1 shows the command characters and their functions. It is split into three parts corresponding to the three main functions of a configuration file, which are covered later in "A Functional Description of the Configuration File."
<BR></P>
<UL>
<LH><B>Table 41.1. </B><B>sendmail.cf</B><B> command characters.</B>
<BR></LH></UL>
<TABLE BORDER>
<TR>
<TD>
<PRE><I>Command Character</I>
<BR></PRE>
<TD>
<PRE><I>Command Syntax and Example</I>
<BR></PRE>
<TD>
<PRE><I>Function</I>
<BR></PRE>
<TR>
<TD>
<P>#</P>
<TD>
<P># comments are ignored</P>
<TD>
<P>A comment line. Always use lots of comments.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B># Standard RFC822 parsing</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>D</P>
<TD>
<P>DX string</P>
<TD>
<P>Define a macro X to have the string value string.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>DMmailhub.gonzo.gov</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>C</P>
<TD>
<P>CX word1 word2 ...</P>
<TD>
<P>Define a class<B> </B>X as<B> </B>word1 word2 ...</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>Cwlocalhost myuucpname</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>F</P>
<TD>
<P>FX/path/to/a/file</P>
<TD>
<P>Define a class X by reading it from a file.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>Fw/etc/mail/host_aliases</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>H</P>
<TD>
<P>H?mailerflag?name:template</P>
<TD>
<P>Define a mail header.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>H?F?From: $q</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>O</P>
<TD>
<P>OX option arguments</P>
<TD>
<P>Set option X. Most command-line options may be set in sendmail.cf.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>OL9 # set log level to 9</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>P</P>
<TD>
<P>Pclass=nn</P>
<TD>
<P>Set mail delivery precedence based on the class of the mail.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>Pjunk=-100</B></P>
<TD>
<P><BR></P>
<TR>
<TD>
<P>V</P>
<TD>
<P>Vn</P>
<TD>
<P>Tell V8 sendmail the version level of the configuration file.</P>
<TR>
<TD>
<P><BR></P>
<TD>
<P><B>V3</B></P>
<TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -