$29.66 $32.95 Save 10% Current price is $29.66, Original price is $32.95. You Save 10%.

Product Details

ISBN-13: 9781565920569
Publisher: O'Reilly Media, Incorporated
Publication date: 11/08/1993
Series: Computer Science Series
Pages: 830
Product dimensions: 5.98(w) x 8.96(h) x 1.76(d)

About the Author

is Sendmail, Inc.'s chief technology officer and co-founder. Allman authored sendmail, the world's first Internet Mail program, in 1981 while at the University of California at Berkeley. He continues to spearhead, the global team of volunteers that maintain and support the sendmail open source platform.

is CTO with SL3D, Inc. in Boulder, Colorado. He has been active in system administration for over fifteen years and has been writing articles and books about computer software for over twenty years. His most notable books are C from A to Z (Prentice Hall), Unix Communications (Howard Sams), and, of course, sendmail (O'Reilly & Associates).

Read an Excerpt

Chapter 1: Introduction

Imagine yourself with pen and paper, writing a letter to a friend far away. You finish the letter and sign it, reflect on what you've written, then tuck the letter into an envelope. You put your friend's address on the front, your return address in the left-hand corner, and a stamp in the right-hand corner, and the letter is ready for mailing. Electronic mail (email for short) is prepared in much the same way, but a computer is used instead of pen and paper.

The post office transports real letters in real envelopes, whereas sendmail transports electronic letters in electronic envelopes. If your friend (the recipient) is in the same neighborhood (on the same machine), only a single post office (sendmail running locally) is involved. If your friend is distant, the mail message will be forwarded from the local post office (sendmail running locally) to a distant one (sendmail running remotely) for delivery. Although sendmail is similar to a post office in many ways, it is superior in others:

  • Delivery typically takes seconds rather than days.

  • Address changes (forwarding) take effect immediately, and mail can be forwarded anywhere in the world.

  • Host addresses are looked up dynamically. Therefore, machines can be moved or renamed, and email delivery will still succeed.

  • Mail can be delivered through programs that access other networks (such as UUCP and BITNET).

    This would be like the post office using United Parcel Service to deliver an overnight letter.

This analogy between a post office and sendmail will break down as we explore sendmail in more detail. But the analogy serves a role in this introductory material, so we will continue to use it to illuminate a few of sendmail's more obscure points.

1.1 MUA Versus MTA

A mail user agent (MUA) is any of the many programs that users run to read, reply to, compose, and dispose of email. Examples of an MUA include the original UNIX mail program (/bin/mail); the Berkeley Mail program; its System V equivalent (mailx); free software programs such as mush, elm, and mh; and commercial programs such as Zmail. Many MUAs may exist on a single machine. MUAs sometimes perform limited mail transport, but this is usually a very complex task for which they are not suited. We won't be covering MUAs in this book.

A mail transfer agent (MTA) is a highly specialized program that delivers mail and transports it between machines, like the post office. Usually, there is only one MTA on a machine. The sendmail program is an MTA. Others include MMDF, Smail 3.x, and Zmailer, but we'll cover only sendmail in this book.

1.2 Why Is sendmail So Complex?

In its simplest role, that of transporting mail from a user on one machine to another user on the same machine, sendmail is almost trivial. All vendors supply a sendmail (and configuration file) that will accomplish this. But as your needs increase, the job of sendmail becomes progressively more complicated, and its configuration file becomes more complex. On hosts that are connected to the Internet, for example, sendmail should use the Domain Name System (DNS) to translate hostnames into network addresses. Machines with UUCP connections, on the other hand, need to have sendmail run the uux program.

The sendmail program needs to transport mail between a wide variety of machines. Consequently, its configuration file is designed to be very flexible. This concept allows a single binary to be distributed to many machines, where the configuration file can be customized to suit particular needs. This configurability contributes to making sendmail complex.

Consider, for example, when mail needs to be delivered to a particular user. The sendmail program decides on the appropriate delivery method based on its configuration file. One such decision process might include the following steps:

  • If the recipient receives mail on the same machine as the sender, deliver the mail using the /bin/mail program.

  • If the recipient's machine is connected to the sending machine using UUCP, use uux to send the mail message.

  • If the recipient's machine is on the Internet, the sending machine transports the mail over the Internet.

  • Otherwise, the mail message may need to be transported over another network (such as BITNET) or possibly rejected.

1.3 Three Important Parts

The sendmail program is actually composed of several parts, including programs, files, directories, and the services it provides. Its foundation is a configuration file that defines the location and behavior of these other parts and contains rules for rewriting addresses. A queue directory holds mail until it can be delivered. An aliases file allows alternative names for users and creation of mailing lists.

1.3.1 The Configuration File

The configuration file contains all the information sendmail needs to do its job. Within it you provide information, such as file locations, permissions, and modes of operation.

Rewriting rules and rule sets also appear in the configuration file. They transform a mail address into another form that may be required for delivery. They are perhaps the single most confusing aspect of the configuration file. Because the configuration file is designed to be fast for sendmail to read and parse, rules can look cryptic to humans:

R$+@$+ $:$1<@$2> focus on domain
R$+<$+@$+> $1$2<@$3> move gaze right

But what appears to be complex is really just succinct. The R at the beginning of each line, for example, labels a rewrite rule. And the $+ expressions mean to match one or more parts of an address. With experience, such expressions (and indeed the configuration file as a whole) soon become meaningful.

1.3.2 The Queue

Not all mail messages can be delivered immediately. When delivery is delayed, sendmail must be able to save it for later transmission. The sendmail queue is a directory that holds mail until it can be delivered. A mail message may be queued:

  • When the destination machine is unreachable or down. The mail message will be delivered when the destination machine returns to service.

  • When a mail message has many recipients. Some mail messages may be successfully delivered, and others may not. Those that fail are queued for later delivery.

  • When a mail message is expensive. Expensive mail (such as mail sent over a long-distance phone line) can be queued for delivery when rates are lower.

  • When safety is of concern. The sendmail program can be configured to queue all mail messages, thus minimizing the risk of loss should the machine crash.

1.3.3 Aliases and Mailing Lists

Aliases allow mail that is sent to one address to be redirected to another address. They also allow mail to be appended to files or piped through programs, and they form the basis of mailing lists. The heart of aliasing is the aliases(5) file (often stored in database format for swifter lookups). Aliasing is also available to the individual user via a file called .forward in the user's home directory....

Table of Contents

Part 1: A Tutorial

Chapter 1. Introduction
1.1 MUA Versus MTA
1.2 Why Is sendmail So Complex?
1.3 Three Important Parts
1.4 Run sendmail by Hand
1.5 The Header
1.6 The Body
1.7 The Envelope
1.8 Things to Try

Chapter 2. Have a V8
2.1 Get the Source
2.2 Read the Documents
2.3 What's What in src
2.4 Preliminaries
2.5 Build
2.6 Test It
2.7 Things to Try

Chapter 3. The Roles of sendmail
3.1 Role in the Filesystem
3.2 Role in Local Delivery
3.3 Role in Network Transport
3.4 Role as a Daemon
3.5 Things to Try

Chapter 4. How to Run sendmail
4.1 Become a Mode (\(enb)
4.2 Verbose (\(env)
4.3 Debugging (\(end)
4.4 Things to Try

Chapter 5. The File
5.1 Overview
5.2 The Minimal File
5.3 A Quick Tour
5.4 Things to Try

Chapter 6. The Mail Hub and Delivery Agents
6.1 The File
6.2 Define a Mail Delivery Agent
6.3 The local Delivery Agent
6.4 Add the Missing Parts to Mhub
6.5 Things to Try

Chapter 7. Macros
7.1 Overview
7.2 Defining Macros
7.3 Predefined Macros
7.4 Things to Try

Chapter 8. Addresses and Rules
8.1 A Fictional Network
8.2 Why Rules?
8.3 Rule Sets
8.4 Rules
8.5 The Workspace
8.6 The Flow of Addresses Through Rules
8.7 Wildcard Operators
8.8 Things to Try

Chapter 9. Rule Set 0
9.1 Introducing Rule Set\ 0
9.2 The RHS Triple
9.3 Testing Rule Set 0
9.4 The error Delivery Agent
9.5 Things to Try

Chapter 10. Rule Set 3
10.1 Why Preprocess?
10.2 Rule Set 3
10.3 Missing Addresses
10.4 Nested Angle Brackets
10.5 Details of Rule Flow
10.6 Things to Try

Chapter 11. Rule Sets 1 and S=
11.1 Flow of the Sender's Address
11.2 Rule Set S=
11.3 All Mail from the Hub
11.4 Rule Set Hubset
11.5 Testing So Far
11.6 Handling user@thishost
11.7 Rule Set 1
11.8 Things to Try

Chapter 12. Class
12.1 The Class Command
12.2 The File Form of Class
12.3 Things to Try

Chapter 13. Setting Options
13.1 Options: An Overview
13.2 Required Options
13.3 Testing the Options
13.4 Sending Mail
13.5 Things to Try

Chapter 14. Headers, Precedence, and Trust
14.1 Headers
14.2 Headers Versus Delivery Agent Flags
14.3 Headers Learned So Far
14.4 Precedence
14.5 Sending Real Mail
14.6 Trusted User
14.7 Things to Try

Chapter 15. Install and Test the File
15.1 Test the Configuration File
15.2 The Real Queue Directory
15.3 MX Records
15.4 Hub Accepts Mail for Client
15.5 Prevent the Daemon from Running
15.6 Install the File
15.7 Things to Try

Chapter 16. The File and m4
16.1 The cf/cf Directory
16.2 The File
16.3 Run m4
16.4 Test the Result
16.5 Qualify All Addresses?
16.6 Things to Try

Chapter 17. The Hub's Complex Rules
17.1 Rule Set 3
17.2 Rule Set 96
17.3 Rule Set 0
17.4 Rule Set 4
17.5 Things to Try

Part 2: Build and Install

Chapter 18. Compile and Install sendmail
18.1 To Use or Not to Use
18.2 Vendor Versus Compiling
18.3 Obtain the Source
18.4 Tuning Makefile
18.5 Run Make
18.6 Install sendmail
18.7 Pitfalls
18.8 Alphabetized Reference

Chapter 19. V8 m4 Configuration
19.1 The m4 Preprocessor
19.2 Build with m4
19.3 The Minimal mc File
19.4 m4 Macros by Function
19.5 Pitfalls
19.6 Alphabetized m4 Macros

Chapter 20. The checkcompat() Cookbook
20.1 How checkcompat() Works
20.2 The Cookbook
20.3 Alphabetized V8.8 Subroutines

Part 3: Administration

Chapter 21. DNS and sendmail

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews