Add a section on basic sendmail configuration.
While I'm here, add <application> arround a couple of instances of sendmail and remove a "This section taken from the FAQ" line since that describes much of the Handbook. Submitted by: Chris Shumway <christopher.shumway@windriver.com>
This commit is contained in:
parent
0f839c1480
commit
6239ae1664
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=10357
1 changed files with 273 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
The FreeBSD Documentation Project
|
||||
|
||||
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/mail/chapter.sgml,v 1.27 2001/08/09 23:42:32 chern Exp $
|
||||
$FreeBSD: doc/en_US.ISO8859-1/books/handbook/mail/chapter.sgml,v 1.28 2001/08/10 22:58:15 chern Exp $
|
||||
-->
|
||||
|
||||
<chapter id="mail">
|
||||
|
@ -175,6 +175,272 @@
|
|||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="sendmail">
|
||||
<title><application>sendmail</application> Configuration</title>
|
||||
|
||||
<indexterm>
|
||||
<primary><application>sendmail</application></primary>
|
||||
</indexterm>
|
||||
|
||||
<para>&man.sendmail.8; is the default Mail Transfer Agent (MTA) in
|
||||
FreeBSD. <application>sendmail</application>'s job is to accept
|
||||
mail from Mail User Agents (MUA) and deliver it to the
|
||||
approperate mailer as defined by its configuration file.
|
||||
<application>sendmail</application> can also accept network
|
||||
connections and deliver mail to local mailboxes or deliver it to
|
||||
another program.</para>
|
||||
|
||||
<para><application>sendmail</application> uses the following
|
||||
configuration files:</para>
|
||||
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/access</filename></primary>
|
||||
</indexterm>
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/aliases</filename></primary>
|
||||
</indexterm>
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/local-host-names</filename></primary>
|
||||
</indexterm>
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/mailer.conf</filename></primary>
|
||||
</indexterm>
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/mailertable</filename></primary>
|
||||
</indexterm>
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/sendmail.cf</filename></primary>
|
||||
</indexterm>
|
||||
<indexterm>
|
||||
<primary><filename>/etc/mail/virtusertable</filename></primary>
|
||||
</indexterm>
|
||||
<informaltable>
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Filename</entry>
|
||||
<entry>Function</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/access</filename>
|
||||
</entry>
|
||||
<entry><application>sendmail</application> access database
|
||||
file</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/aliases</filename>
|
||||
</entry>
|
||||
<entry>Mailbox aliases</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/local-host-names</filename>
|
||||
</entry>
|
||||
<entry>Lists of hosts <application>sendmail</application>
|
||||
accepts mail for</entry>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/mailer.conf</filename>
|
||||
</entry>
|
||||
<entry>Mailer program configuration</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/mailertable</filename>
|
||||
</entry>
|
||||
<entry>Mailer delivery table</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/sendmail.cf</filename>
|
||||
</entry>
|
||||
<entry><application>sendmail</application> master
|
||||
configuration file</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
<filename>/etc/mail/virtusertable</filename>
|
||||
</entry>
|
||||
<entry>Virtual users and domain tables</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
|
||||
<sect2>
|
||||
<title><filename>/etc/mail/access</filename></title>
|
||||
|
||||
<para>The access database defines what host(s) or IP addresses
|
||||
have access to the local mail server and what kind of access
|
||||
they have. Hosts can be listed as <option>OK</option>,
|
||||
<option>REJECT</option>, <option>RELAY</option> or simply passed
|
||||
to <application>sendmail</application>'s error handling routine with a given mailer error.
|
||||
Hosts that are listed as <option>OK</option>, which is the
|
||||
default, are allowed to send mail to this host as long as the
|
||||
mail's final destination is the local machine. Hosts that are
|
||||
listed as <option>REJECT</option> are rejected for all mail
|
||||
connections. Hosts that have the <option>RELAY</option> option
|
||||
for their hostname are allowed to send mail for any destination
|
||||
through this mail server.</para>
|
||||
|
||||
<example>
|
||||
<title>Configuring the <application>sendmail</application>
|
||||
Access Database</title>
|
||||
|
||||
<programlisting>cyberspammer.com 550 We don't accept mail from spammers
|
||||
FREE.STEALTH.MAILER@ 550 We don't accept mail from spammers
|
||||
another.source.of.spam REJECT
|
||||
okay.cyberspammer.com OK
|
||||
128.32 RELAY</programlisting>
|
||||
</example>
|
||||
|
||||
<para>In this example we have five entries. Mail senders that
|
||||
match the left hand side of the table are affected by the action
|
||||
on the right side of the table. The first two examples give an
|
||||
error code to <application>sendmail</application>'s error
|
||||
handling routine. The message is printed to the remote host when
|
||||
a mail matches the left hand side of the table. The next entry
|
||||
rejects mail from a specific host on the Internet,
|
||||
<hostid>another.source.of.spam</hostid>. The next entry accepts
|
||||
mail connections from a host
|
||||
<hostid>okay.cyberspammer.com</hostid>, which is more exact than
|
||||
the <hostid>cyberspamer.com</hostid> line above. More specific
|
||||
matches override less exact matches. The last entry allows
|
||||
relaying of electronic mail from hosts with an IP address that
|
||||
begins with <hostid>128.32</hostid>. These hosts would be able
|
||||
to send mail through this mail server that are destined for other
|
||||
mail servers.</para>
|
||||
|
||||
<para>When this file is updated, you need to run
|
||||
<command>make</command> in <filename>/etc/mail/</filename> to
|
||||
update the database.</para>
|
||||
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title><filename>/etc/mail/aliases</filename></title>
|
||||
|
||||
<para>The aliases database contains a list of virtual mailboxes
|
||||
that are expanded to other user(s), files, programs or other
|
||||
aliases. Here is a few examples that can be used in
|
||||
<filename>/etc/mail/aliases</filename>:</para>
|
||||
|
||||
<example>
|
||||
<title>Mail Aliases</title>
|
||||
<programlisting>root: localuser
|
||||
ftp-bugs: joe,eric,paul
|
||||
bit.bucket: /dev/null
|
||||
procmail: "|/usr/local/bin/procmail"</programlisting>
|
||||
</example>
|
||||
|
||||
<para>The aliases update matches the mailbox name on the left of
|
||||
the colon, and will expand it to the target(s) on the right.
|
||||
The first example simply expands the mailbox root to the mailbox
|
||||
localuser, which is then looked up again in the aliases
|
||||
database. If no match is found, then the message is delivered
|
||||
to the local user localuser. The next example shows a mail
|
||||
list. Mail to the mailbox ftp-bugs is expanded to the three
|
||||
local mailboxes joe, eric, and paul. Note that a remote mailbox
|
||||
could be specified as user@domain.com. The next example shows
|
||||
writing mail to a file, in this case
|
||||
<filename>/dev/null</filename>. The last example shows sending
|
||||
mail to a program, in this case the mail message is written to
|
||||
the standard input of
|
||||
<filename>/usr/local/bin/procmail</filename> through a Unix
|
||||
pipe.</para>
|
||||
|
||||
<para>When this file is updated, you need to run
|
||||
<command>make</command> in <filename>/etc/mail/</filename> to
|
||||
update the database.</para>
|
||||
<sect2>
|
||||
<title><filename>/etc/mail/local-host-names</filename></title>
|
||||
|
||||
<para>This is a list of hostnames &man.sendmail.8; is to accept as
|
||||
the local host name. Place any domains or hosts that
|
||||
<application>sendmail</application> is to be receiving mail for.
|
||||
For example, if this mail server was to accept mail for the
|
||||
domain example.com and the host
|
||||
<hostid>mail.example.com</hostid>, its
|
||||
<filename>local-host-names</filename> might look something like
|
||||
this:</para>
|
||||
|
||||
<programlisting>example.com
|
||||
mail.example.com</programlisting>
|
||||
|
||||
<para>When this file is updated, &man.sendmail.8; needs to be
|
||||
restarted for it to read the changes.</para>
|
||||
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title><filename>/etc/mail/mailer.conf</filename></title>
|
||||
|
||||
<para>The <filename>mailer.conf</filename> configuration file
|
||||
holds a table containing the real mailer that is used for the
|
||||
given action. Very old software programs would hard-code in the
|
||||
name and path to the mailer,
|
||||
<filename>/usr/sbin/sendmail</filename>, which meant they where
|
||||
incompatable with other mailers such as postfix. Today,
|
||||
<filename>/usr/sbin/sendmail</filename> is a wrapper that looks
|
||||
at <filename>/etc/mail/mailer.conf</filename> and executes the
|
||||
correct binary. When another mail transfer agent is installed
|
||||
on the system, <filename>mailer.conf</filename> should be
|
||||
updated to reflect the correct programs to execute.</para>
|
||||
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title><filename>/etc/mail/sendmail.cf</filename></title>
|
||||
|
||||
<para><application>sendmail</application>'s master configuration
|
||||
file, <filename>sendmail.cf</filename> controls the overall
|
||||
behavior of <application>sendmail</application>. Everything
|
||||
from rewriting e-mail addresses to printing reject messages for
|
||||
remote mail servers. Naturally, with such a diverse role, this
|
||||
configuration file is quite complex and its details are a bit
|
||||
out of the scope of this chapter. Fortunately, this file rarely
|
||||
needs to be changed for standard mail servers.</para>
|
||||
|
||||
<para>The master <application>sendmail</application> configuration
|
||||
file can be built from &man.m4.1; macros that define features
|
||||
and behavior of sendmail. Please see
|
||||
<filename>/usr/src/contrib/sendmail/cf/README</filename> for
|
||||
some of the details.</para>
|
||||
|
||||
<para>When changes to this file are made,
|
||||
<application>sendmail</application> needs to be restarted for
|
||||
the changes to take effect.</para>
|
||||
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title><filename>/etc/mail/virtusertable</filename></title>
|
||||
|
||||
<para>The virtualusertable maps mail for virtual domains and
|
||||
mailboxes to real mailboxes. These mail boxes can be local,
|
||||
remote, point to an alias defined in
|
||||
<filename>/etc/mail/aliases</filename> or to a file.</para>
|
||||
|
||||
<example>
|
||||
<title>Example Virtual Domain Mail Map</title>
|
||||
|
||||
<programlisting>root@example.com root
|
||||
postmaster@example.com postmaster@noc.example.net
|
||||
@example.com joe</programlisting>
|
||||
</example>
|
||||
|
||||
<para>In the above example, we have a mapping for a domain
|
||||
<hostid>example.com</hostid>. This file is processed in a
|
||||
first match order down the file. The first item, maps
|
||||
root@example.com to the local mailbox root. The next entry maps
|
||||
postmaster@example.com to the mailbox postmaster on the host
|
||||
noc.example.net. Finally, if nothing from example.com has
|
||||
matched so far, it will match the last mapping, which matches
|
||||
every other mail message addressed to someone at example.com.
|
||||
This will be mapped to the local mail box joe.</para>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 id="mail-trouble">
|
||||
<title>Troubleshooting</title>
|
||||
<indexterm>
|
||||
|
@ -182,9 +448,6 @@
|
|||
<secondary>troubleshooting</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>Here are some frequently asked questions and answers. These
|
||||
have been migrated from the <ulink url="../FAQ/">FAQ</ulink>.</para>
|
||||
|
||||
<qandaset>
|
||||
<qandaentry>
|
||||
<question>
|
||||
|
@ -235,12 +498,13 @@
|
|||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>Sendmail says <errorname>mail loops back to
|
||||
myself</errorname></para>
|
||||
<para><application>sendmail</application> says <errorname>mail
|
||||
loops back to myself</errorname></para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>This is answered in the sendmail FAQ as follows:</para>
|
||||
<para>This is answered in the
|
||||
<application>sendmail</application> FAQ as follows:</para>
|
||||
|
||||
<programlisting>* I am getting <quote>Local configuration error</quote> messages, such as:
|
||||
|
||||
|
@ -256,15 +520,15 @@ itself as domain.net. Add domain.net to /etc/sendmail.cw
|
|||
(if you are using FEATURE(use_cw_file)) or add <quote>Cw domain.net</quote>
|
||||
to /etc/sendmail.cf.</programlisting>
|
||||
|
||||
<para>The sendmail FAQ is in
|
||||
<para>The <application>sendmail</application> FAQ is in
|
||||
<filename>/usr/src/usr.sbin/sendmail</filename> and is
|
||||
recommended reading if you want to do any
|
||||
<quote>tweaking</quote> of your mail setup.</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<indexterm><primary>PPP</primary></indexterm>
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>How can I do email with a dial-up PPP host?</para>
|
||||
</question>
|
||||
|
|
Loading…
Reference in a new issue