Sendmail

Help for UNIX System Administrators

Bryan Costales, Eric Allman, Neil Rickert

Publisher: O'Reilly, 1993, 792 pages

ISBN: 1-56592-056-2

Keywords: Programming, System Administration

Last modified: May 30, 2021, 10:46 p.m.

This new Nutshell Handbook is far and away the most comprehensive book ever written on sendmail, a program that acts like a traffic cop in routing and delivering mail on UNIX-based networks. Although sendmail is used on almost every UNIX system, it's one of the last great uncharted territories — and most difficult utilities to learn — in UNIX system administration.

This book provides a complete sendmail tutorial, plus extensive reference material on every aspect of the program. What's more, it's authoritative, having been co-authored by Eric Allman, the developer of sendmail, and Neil Rickert, one of the leading sendmail gurus on the Net.

This book covers both IDA sendmail and the newest version (V8) from the University of California, Berkeley. It also covers the standard version available on most systems, such as those found on Sun and DEC/Ultrix workstations.

The book is divided into four parts. Part One is a tutorial on understanding sendmail from the ground up. Starting from an empty file, it has the reader gradually build up a configuration file, testing the results at each stage. The tutorial covers such topics as selecting mail delivery agents, macros, rules and rule sets, class macros, options, and headers.

Part Two deals, with practical topics sendmail administration, including how to compile and install sendmail from source, how to integrate sendmail and the Domain Naming System (DNS), security, queue management, aliases, mailing lists, and logging and statistics.

Part Three is a comprehensive reference section, including alphabetized references to all options, macros, debugging switches, and headers.

Part Four consists of appendices dealing with details such as queue file intervals, error messages, the "define" macros in the config.h file, a complete copy of the client.cf file developed in the tutorial, V8 and IDA configuration macros, and a bibliography.

  1. Tutorial
    1. Introduction
      • MUA Versus MTA
      • Why Is sendmail So Complex?
      • Some Parts of sendmail
        • The Configuration File
        • The Queue
        • Aliases and Mailing Lists
      • Additional Information Sources
        • The RFCs
        • Other Books
    2. The E-mail Message
      • Run sendmail by Hand
      • The Header
      • The Body
      • The Envelope
      • Things to Try
    3. The Roles of sendmail
      • The File System Hierarchy
        • The Aliases File: /etc/aliases
        • The Queue Directory: /var/spool/mqueue
      • Local Delivery
        • Delivery to a Mailbox: /bin/mail
        • Delivery Through a Program: /bin/sh
      • Network Forwarding
        • TCP/IP
        • UUCP
        • Other Protocols
      • The sendmail Daemon
      • Things to Try
    4. How to Run sendmail
      • Become Mode (-b)
        • Daemon Mode (-bd)
        • Show Queue Mode (-bp)
        • Rebuild Aliases Mode (-bi)
        • Verify Mode (-bv)
      • Verbose Mode (-v)
      • Debugging Mode (-d)
      • Things to Try
    5. The sendmail.cf File
      • Overview of the sendmail.cf File
        • Comments
        • Version (V8 Only)
        • Mail Delivery Agents
        • Macros
        • Rules
        • Rule Sets
        • Class Macros
        • File Class Macros
        • Options
        • Headers
        • Priority
        • Trusted Users
        • Keyed Databases (V8 Only)
      • Things to Try
    6. Mail Delivery Agents
      • The client.cf File
      • Define a Mail Delivery Agent
        • Testing the client.cf File
      • The local and prog Delivery Agents
        • Skipping Rule Sets
        • Adding Comments
        • Testing the New Delivery Agent Definitions
      • Add the Missing Parts to Mhub
      • Things to Try
    7. Macros
      • Overview of Macros
      • Defining Macros
      • Predefined Macros
      • Required Macros
      • Putting It All Together
      • Things to Try
    8. Addresses and Rules
      • A Fictional Network
        • The dc.goc Domain
        • The acme.com Domain
        • The us.edu Domain
        • UUCP and Host Paths
      • Why Rules?
      • Rule Sets
      • Rules
      • The Workspace
      • The Flow of Addresses Through Rules
      • Operators Versus the Workspace
        • Other Text in the LHS
        • Minimal Matching
        • More Play With LHS Matching
      • Things to Try
    9. Rule Set 0
      • Introducing Rule Set 0
      • The RHS Triple
        • The Delivery Agent ($#)
        • The Host ($@)
        • The User ($:)
      • Testing Rule Set 0
      • The error Delivery Agent
      • Things to Try
    10. Rule Set 3
      • Why Preprocess?
      • Rule Set 3
        • The LHS
        • The RHS
        • The Comment
        • Test Rule Set 3
      • Missing Addresses
      • Nested Angle Brackets
      • Details of Rule Flow
      • Things to Try
    11. Rule Sets 1 and S=
      • Flow of the Sender's Address
      • Rule Set S=
      • All Mail From the hub
      • Rule Set 10
        • Rewrite the Lone User Name
        • A Word About $H
      • Testing So Far
      • Handling user@this.host
      • Rule Set 1
      • Things to Try
    12. Class
      • The Class Command
        • Declaring a Class
        • Multiple Known Names for the Local Host
        • Class Macros in the LHS
        • Class Macros in the RHS
        • Testing Class
        • Adding the Domain
        • Internally Defined Class ($=w)
      • The File Form of Class
        • The scanf(3) Pattern
      • Things to Try
    13. Setting Options
      • Options: An Overview
      • Required Options
        • The Location of the Queue Directory (OQ)
        • Limit the Life of Queued Messages (OT)
        • The Default Delivery Mode (Od)
        • The Default File Permissions (OF)
        • The Default User Identities (Ou and Og)
        • The Default Logging Level (OL)
        • Timeout for SMTP reads (Or)
        • Accept Old-style Lists of Addresses (Oo)
        • The Unquoted Space Replacement Character (OB)
      • Testing the Options
      • Sending Mail
      • Things to Try
    14. Header, Priority, Trusted
      • Headers
        • The From: Header
        • The Received: Header
        • Testing So Far
      • Headers Versus Delivery Agent Flags
        • The Full-Name: Header
        • The Date: Header
        • The Message-Id: Header
      • Headers Learned So Far
      • Priorities
      • Sending Real Mail
      • Trusted User
      • Things to try
    15. Loose Ends
      • Test the Configuration File
      • The Real Queue and OQ
      • MX Records
      • Hub Accepts Mail from Client
      • Prevent the Daemon from Running
      • Arrange for Hourly Queue Runs
      • Install the client.cf File
      • Things to Try
  2. Administration
    1. Compile and Install sendmail
      • Decide Which Version
        • Consider Heterogeneity
        • Consider Security
        • Consider Protocol Support
      • Obtain the Source
        • V8 sendmail
        • IDA sendmail
        • Via ftpmail
        • What's Where in the Source?
      • Decisions in conf.h
        • Knowledgeable Hub's conf.h
        • Dumb Client's config.h
        • Database Library Selection in conf.h (IDA)
        • Database Library Selection in conf.h (V8)
        • Protocol Selection in conf.h (V8)
        • Other Decisions in conf.h
      • Decisions in conf.c
        • Header Decisions in conf.c
        • Uses of checkcompat() in conf.c
        • Accept Only Mail From Our Domain
        • Refuse to Act as a Mail Gateway
        • Limit the Size of Guest Messages
      • Decisions in pathnames.h (V8 Only)
      • Decisions in Makefile
        • IDA Makefile
        • V8 Makefile
      • Run Make
        • Use libresolv.a (IDA and V8)
        • Other Missing Library Routines
      • Install
      • Pitfalls
    2. DNS and sendmail
        • Which DNS; 4.8.3 or 4.9?
      • DNS Enquiries by sendmail
        • Determine the Local Canonical Name
        • Look Up a Remote Host's Name
        • Look Up Addresses for Delivery
        • The $[ and $] Operators
      • Set Up MX Records
        • MX Must Point to an A Record
        • MX RTecords Are Non-recursive
        • Wildcard MX Records
        • What? They Ignore MX Records?
        • Caching MX Records
        • Ambiguous MX Records
      • Using nslookup
      • Prepare for Disaster
        • Offsite MX Hosts
        • Offsite Primaries
      • Pitfalls
    3. Security
      • SMTP Probes
        • SMTP debug
        • SMTP vrfy and expn
      • The Configuration File
        • The F Command — File Form
        • The F Command — Program Form
        • The A= of Delivery Agents
        • The S Option and the Statistics File
      • Permissions
        • Permissions for :include:
        • Permissions for ~/.forward Files
        • Recommended Permissions
      • The Aliases File
        • The Alias Database Files
      • Forged Mail
        • Forging With the Queue Directory
        • Forging with SMTP
      • Trusted Users
        • Declare Trusted Users (Not V8)
      • Pitfalls
    4. The Queue
      • Overview of the Queue
      • Parts of a Queued File
        • The Data (Message Body) File: df
        • The Lock FIle: lf
        • The ID Creation File; nf
        • The Queue Control File: qf
        • The Temporary qf Rewrite Image: tf
        • The Transcript File: xf
      • Printing the Queue
        • Printing the Queue in Verbose Mode
      • How the Queue is  Processed
        • Processing a Single Message
      • Cause the Queue to be Processed
        • Periodically With -q
        • From the Command Line
      • Process Alternate Queues
        • Handling a Down Site
      • Pitfalls
    5. Aliases
      • Local Must Be Local
      • Delivery to Users
      • Delivery to Files
      • Delivery via Programs
        • Program Behavior
      • Required Aliases
        • The Postmaster Alias
        • The MAILER-DAEMON Alias
      • The Aliases Database
        • Rebuild the Alias Database
        • Check Right Side of Aliases (V8 Only)
        • Prevent Simultaneous Rebuilds
        • No DBM Aliasing
      • Prevent Aliasing With -n
        • Is An Alias Bad?
        • Filtering Recipients With a Shell Script
      • Pitfalls
    6. Mailing Lists and ~/.forward
      • Internal Mailing Lists
      • :include: Mailing Lists
        • Comments In :include: Lists
        • Tradeoffs
      • Defining a Mailing List Owner
      • Exploder Mailing Lists
      • Problems With Mailing Lists
        • Reply Versus Bounce
        • Gateway Lists to News
        • A list-bounced  Alias
        • Users Ignore List-request
        • Precedence: bulk
        • X.400 Addresses
      • Packages That Help
        • Majordomo
        • Almanac
        • ListProcessor
      • The User's ~/.forward File
        • Unsrcambling Forwards
        • Forwarding Loops
        • Appending to Files
        • Piping Through Programs
        • Specialty Programs for Use WIth ~/.forward
        • Force Requeue on Error
      • Pitfall
    7. Logging and Statistics
      • Logging
        • sysylog(3)
        • Tuning syslog.conf
        • Using m4 (SunOS only)
      • Statistics
        • The sendmail.st FIle
        • Viewing Statistics: mailstats
        • Using cron for Daily and Weekly Statistics
        • Gathering Statistics From syslog
        • Available perl(1) scipts
      • Pitfalls
  3. Reference
    1. The Configuration File
      • Overall Syntax
      • Comments
      • V8 Comments
      • Continuation Lines
      • The V Configuration Command
      • Pitfalls
    2. Rule Sets
      • The S Configuration Command
      • The Sequence of Rule Sets
        • IDA Enhancements
        • V8 Enhancements
        • V8 Rule Set 5 Enhancements
      • Rule Set 3
        • A Special Case: From: <>
        • Basic Textual Canonicalization
        • Handling Routing Addresses
        • Handling Specialty Addresses
        • Focusing for @ Syntax
      • Rule Set 4
        • Resolving Numeric Addresses
        • Stripping Trailing Dots
        • Restoring Source Routes
        • Removing Focus
        • Correcting Tags
      • Rule Set 0
        • Further processing: $:user
        • Selecting S= and R=
        • Delivering to Local Recipient
        • Forwarding to a Knowledgeable Host
        • Handling UUCP Locally
        • Forwarding Over the Network
        • Handling Leftover Local Addresses
      • Rule Set 2
      • Rule Set 1
      • Rule Set Testing With -bt
        • Rule 3 Always Called First With -bt
        • Syntax of -bt
        • The Output Produced by -bt
        • Bypassing Rule Set 3 With -bt
        • More Detail: -d Combined With -bt
        • Batch Rule-set Testing With -bt
      • Pitfalls
    3. Rules
      • Overview
        • Macros in Rules
        • Rules Are Treated Like Addresses
      • Tokenizing Rules
        • $ Operators Are Tokens
        • The Space Character Is Special
        • Pasting Addresses Back Together
      • The Workspace
      • The Behavior of a Rule
      • The LHS
        • Minimum Matching
        • Backup and Retry
      • The RHS
        • Copy by Position: $digit
        • Rewrite Once Prefix: $:
        • Rewrite-and-return Prefix: $@
        • Rewrite Through Another Rule Set: $>set
        • Specify a Delivery Agent: $#
        • Canonicalize Hostname: $[ and $]
        • Default in Canonicalization: $:
        • Other Operators
      • Pitfalls
    4. Delivery Agents
      • Syntax
      • The Symbolic Name
        • Required Symbolic Names
      • The Equates
        • The Argv for This Delivery Agent: A=
        • The Default Character Set (IDA Only): C=
        • Paths of Working Directories (V8 Only): D=
        • The End-of-line String: E=
        • Delivery Agent Flags: F=
        • Maximum Line Length (IDA and V8 Only): L=
        • Maximum Message Size: M=
        • Path to the Delivery Agent; P=
        • Recipient Rewriting Set: R=
        • Sender Rewriting Set: S=
        • Default Escape Character (IDA Only): X=
      • Special V8 Symbolic Names
      • Pitfalls
      • Alphabetized Reference
    5. Defined Macros
      • Pre-assigned Macros
      • Command-line Definitions
        • Syntax of the Command-line Macro's Text
      • Configuration File Definitions
        • Required Macros
        • Syntax of the Configuration File Macro's Text
      • Characters That May Be Macro Names
      • Macro Expansion: $, $&, and $!
        • When Is a Macro Expandable?
        • Use Value As-is (IDA and V8 Only): $&
        • Quote Special Characters (IDA Only): $!
      • Macro Conditionals: $?, $|, and $.
        • Conditionals May Nest (V8 Only)
      • Pitfalls
      • Alphabetized Reference
    6. Class Macros
      • Class Configuration Commands
        • The C Class Command
        • The F Class Command
      • Access Class in Rules
        • Matching Any in a Class: $=
        • Matching Any Not in a Class: $~
        • Backup and Retry
        • Class Name Hashing Algorithm
      • Internally Defined Class w
        • Adding to Class w
      • Pitfalls
    7. Database Macros
      • Sun NIS Databases
        • Creating an NIS Map
        • Matching From an NIS Map in the LHS
        • Rewriting With an NIS Map in the RHS
      • IDA Databases
        • Creating the Database Files
        • Define a Database With Option K
        • Rewriting in the RHS
      • V8 Databases
        • Create the Map With makemap
        • The K Configuration Command
        • Use the Map wit $( and $)
      • Pitfalls
    8. Options
      • Command-line Options
      • Configuration File Options
      • Option Argument Types
      • Interrelating Options
        • File Locations
        • The Queue
        • Managing Aliases
        • Controlling Machine Load
        • Connection Caching
        • Problem Solving
        • Other Options
      • Pitfalls
      • Alphabetized Reference
    9. Headers
      • The H Configuration Command
      • Header Names
      • Header Field Contents
        • Macros in the Header Field
        • Escape Character in the Header Field
        • Quoted Strings in the Header Field
        • Comments in the Header Field
      • ?flags? in Header Definitions
      • Headers by Category
        • Recommended Headers
        • Sender Headers
        • Recipient Headers
        • Identification and Control Headers
        • Date and Trace Headers
        • Other RFC822 Headers
      • Forwarding with Resent-Headers
      • Precedence: Configuration and Header
        • Syntax
      • Pitfalls
      • Alphabetized Reference
    10. The Command Line
      • Alternative argv[0]
        • newaliases
        • mailq
        • smtpd
        • bsmtp (IDA only)
      • Command-line Swithces
        • V8 uses getopt(3)
      • List of Recipient Addresses
      • Processing the Command Line
        • Prescanning the Command Line
        • Processing Prior to the Switches
      • Pitfalls
      • Alphabetized Reference
    11. Debugging With -d
      • Syntax of -d
      • Debugging Behavior
      • Interpreting the Output
        • The Output Produced by printaddr()
      • Pitfalls
      • Reference in Numerical Order
  4. Appendices
    1. The qf File Internals
    2. Obscure Error Messages
    3. #define Macros in conf.h
    4. V8 m4 Configuration
      • m4 Names for File Class
    5. IDA m4 Configuration
      • LIBDIR
      • Database Files
        • MAILERTABLE
        • PATHTABLE
        • DOMAINTABLE
        • GENERICFROM
        • UUCPXTABLE
      • Miscellaneous

Reviews

Sendmail

Reviewed by Roland Buresund

Decent ****** (6 out of 10)

Last modified: May 21, 2007, 3:23 a.m.

The standard work on sendmail. Only for masochists.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required