From 6239ae1664fa09ff93044a92fb3c8f1df2b3903a Mon Sep 17 00:00:00 2001 From: Murray Stokely Date: Wed, 15 Aug 2001 02:00:15 +0000 Subject: [PATCH] Add a section on basic sendmail configuration. While I'm here, add 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 --- .../books/handbook/mail/chapter.sgml | 282 +++++++++++++++++- 1 file changed, 273 insertions(+), 9 deletions(-) diff --git a/en_US.ISO8859-1/books/handbook/mail/chapter.sgml b/en_US.ISO8859-1/books/handbook/mail/chapter.sgml index a7dc55a75a..74bb9523cd 100644 --- a/en_US.ISO8859-1/books/handbook/mail/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/mail/chapter.sgml @@ -1,7 +1,7 @@ @@ -174,7 +174,273 @@ possibly your network. + + + <application>sendmail</application> Configuration + + + sendmail + + + &man.sendmail.8; is the default Mail Transfer Agent (MTA) in + FreeBSD. sendmail's job is to accept + mail from Mail User Agents (MUA) and deliver it to the + approperate mailer as defined by its configuration file. + sendmail can also accept network + connections and deliver mail to local mailboxes or deliver it to + another program. + + sendmail uses the following + configuration files: + + + /etc/mail/access + + + /etc/mail/aliases + + + /etc/mail/local-host-names + + + /etc/mail/mailer.conf + + + /etc/mail/mailertable + + + /etc/mail/sendmail.cf + + + /etc/mail/virtusertable + + + + + + Filename + Function + + + + + + /etc/mail/access + + sendmail access database + file + + + + /etc/mail/aliases + + Mailbox aliases + + + + /etc/mail/local-host-names + + Lists of hosts sendmail + accepts mail for + + + /etc/mail/mailer.conf + + Mailer program configuration + + + + /etc/mail/mailertable + + Mailer delivery table + + + + /etc/mail/sendmail.cf + + sendmail master + configuration file + + + + /etc/mail/virtusertable + + Virtual users and domain tables + + + + + + <filename>/etc/mail/access</filename> + + 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 , + , or simply passed + to sendmail's error handling routine with a given mailer error. + Hosts that are listed as , 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 are rejected for all mail + connections. Hosts that have the option + for their hostname are allowed to send mail for any destination + through this mail server. + + + Configuring the <application>sendmail</application> + Access Database + + 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 + + + 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 sendmail'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, + another.source.of.spam. The next entry accepts + mail connections from a host + okay.cyberspammer.com, which is more exact than + the cyberspamer.com 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 128.32. These hosts would be able + to send mail through this mail server that are destined for other + mail servers. + + When this file is updated, you need to run + make in /etc/mail/ to + update the database. + + + + <filename>/etc/mail/aliases</filename> + + 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 + /etc/mail/aliases: + + + Mail Aliases + root: localuser +ftp-bugs: joe,eric,paul +bit.bucket: /dev/null +procmail: "|/usr/local/bin/procmail" + + + 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 + /dev/null. The last example shows sending + mail to a program, in this case the mail message is written to + the standard input of + /usr/local/bin/procmail through a Unix + pipe. + + When this file is updated, you need to run + make in /etc/mail/ to + update the database. + + <filename>/etc/mail/local-host-names</filename> + + This is a list of hostnames &man.sendmail.8; is to accept as + the local host name. Place any domains or hosts that + sendmail is to be receiving mail for. + For example, if this mail server was to accept mail for the + domain example.com and the host + mail.example.com, its + local-host-names might look something like + this: + + example.com +mail.example.com + + When this file is updated, &man.sendmail.8; needs to be + restarted for it to read the changes. + + + + <filename>/etc/mail/mailer.conf</filename> + + The mailer.conf 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, + /usr/sbin/sendmail, which meant they where + incompatable with other mailers such as postfix. Today, + /usr/sbin/sendmail is a wrapper that looks + at /etc/mail/mailer.conf and executes the + correct binary. When another mail transfer agent is installed + on the system, mailer.conf should be + updated to reflect the correct programs to execute. + + + + <filename>/etc/mail/sendmail.cf</filename> + + sendmail's master configuration + file, sendmail.cf controls the overall + behavior of sendmail. 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. + + The master sendmail configuration + file can be built from &man.m4.1; macros that define features + and behavior of sendmail. Please see + /usr/src/contrib/sendmail/cf/README for + some of the details. + + When changes to this file are made, + sendmail needs to be restarted for + the changes to take effect. + + + + <filename>/etc/mail/virtusertable</filename> + + 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 + /etc/mail/aliases or to a file. + + + Example Virtual Domain Mail Map + + root@example.com root +postmaster@example.com postmaster@noc.example.net +@example.com joe + + + In the above example, we have a mapping for a domain + example.com. 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. + + + Troubleshooting @@ -182,9 +448,6 @@ troubleshooting - Here are some frequently asked questions and answers. These - have been migrated from the FAQ. - @@ -235,12 +498,13 @@ - Sendmail says mail loops back to - myself + sendmail says mail + loops back to myself - This is answered in the sendmail FAQ as follows: + This is answered in the + sendmail FAQ as follows: * I am getting Local configuration error 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 Cw domain.net to /etc/sendmail.cf. - The sendmail FAQ is in + The sendmail FAQ is in /usr/src/usr.sbin/sendmail and is recommended reading if you want to do any tweaking of your mail setup. + PPP - PPP How can I do email with a dial-up PPP host?