A classic O'Reilly title since 1993, sendmail now covers Versions 8.10 through 8.14 of this email routing program, including dozens of new features, options, and macros. This edition also takes a more nuts-and-bolts approach than its predecessors. It includes both an administration handbook and a reference guide that provide you with clear options for installing, configuring and managing sendmail's latest versions and companion programs.

The sendmail program has withstood the ...

See more details below
Paperback (Fourth Edition)
$41.72 price
(Save 30%)$59.99 List Price
Other sellers (Paperback)
  • All (9) from $35.04   
  • New (5) from $35.04   
  • Used (4) from $35.04   

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$27.49 price
(Save 42%)$47.99 List Price


A classic O'Reilly title since 1993, sendmail now covers Versions 8.10 through 8.14 of this email routing program, including dozens of new features, options, and macros. This edition also takes a more nuts-and-bolts approach than its predecessors. It includes both an administration handbook and a reference guide that provide you with clear options for installing, configuring and managing sendmail's latest versions and companion programs.

The sendmail program has withstood the test of time because of its ability to solve the mail-routing needs of all sites large or small, complex or simple. But it's also difficult to configure and even more difficult to understand. That's why this book has proven valuable since the dawn of email. With it, you will be able to configure the program to meet any need, so that you never again have to call in a sendmail guru to bail you out.

sendmail includes the following sections:

  • Some Basics is especially useful for people new to the program. It covers the basic concepts underlying mail delivery and the roles sendmail plays in that delivery
  • Administration covers all aspects of handling sendmail, from downloading and installing new releases to managing mailing lists and aliases
  • Configuration Reference contains a heavily cross-referenced guide for configuring and tuning sendmail. Every arcane detail of sendmail is listed alphabetically
  • Appendices contain more detail about sendmail than you may ever need
  • This edition also includes new material on SSL and AUTH and a new chapter on Mitlers. If you're interested in what has changed since the last edition, one appendix categorizes the many improvements of sendmail's intervening versions by chapter, complete with references to the appropriate sections and page numbers in the book.

    With sendmail, system administrators, programmers, network engineers, and even inexperienced users will be able to match this challenging but necessary utility to the needs of their network.

Read More Show Less

Editorial Reviews

For UNIX system administrators, provides a sendmail tutorial, plus reference material on every aspect of the program. Annotation c. Book News, Inc., Portland, OR (
Read More Show Less

Product Details

  • ISBN-13: 9780596510299
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 11/28/2007
  • Edition description: Fourth Edition
  • Edition number: 4
  • Pages: 1312
  • Product dimensions: 7.00 (w) x 9.20 (h) x 2.22 (d)

Meet the Author

Bryan Costales lives and writes in San Francisco, California. He has been active in system administration and software development for more than 20 years and has been writing articles and books about computer software for more than 25 years. His most notable books are "C from A to Z" (Prentice Hall), "Unix Communications" (Howard Sams), and "sendmail" (O'Reilly). In addition to technical books, he also writes fiction and hosts a free multimedia web site.

Claus Assmann is a member of the Sendmail Consortium and works for Sendmail, Inc. He is the maintainer of sendmail 8 and currently implements a new MTA (message transfer agent) named MeTA1. His main interests in computer technology are security and performance. He studied computer science at the University of Kiel in Germany, where he received his Ph.D. in 1992.

George Jansen is a freelance writer who has worked with Bryan Costales on several of Bryan's books. His first novel, The Jesse James Scrapbook, is published by Hilliard & Harris. His second, The Fade-away, is published by Pocol Press. He lives in the Bay Area, drives a brand new Toyota Yaris, and enjoys baseball, classic jazz, and taking long naps.

Gregory Shapiro began his professional career as a systems administrator for Worcester Polytechnic Institute (WPI) after graduating from the university in 1992. During his tenure as Senior Unix Systems Administrator, he became involved with beta testing the BIND name server, the sendmail mail transfer agent, and other Unix utilities such as emacs and screen. His involvement with sendmail grew until he became Principal Engineer at Sendmail, Inc., where he continued to support the open source version while working on Sendmail's commercial products. He later moved into the IT team as the Senior Unix Network Systems Administrator. He is now Director, Strategic Technology at Sendmail, Inc. He is also a
FreeBSD committer and has served as program committee member for BSDCon 2002 and program chair for BSDCon 2003. Greg lives in California and enjoys reading science fiction and fantasy books, traveling, and seeing movies and theater productions.

Read More Show Less

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....
Read More Show Less

Table of Contents

Changes Since the Previous Edition;
Why This Book Is Necessary;
Thoughts from Eric Allman;
Audience and Assumptions;
Unix and sendmail Versions;
Conventions Used in This Book;
Using Code Examples;
Additional Sources of Information;
Other Books, Other Problems;
How to Contact Us;
SafariĀ® Books Online;
Chapter 1: Some Basics;
1.1 Email Basics;
1.2 Requests for Comments (RFCs);
1.3 Email and sendmail;
1.4 Basic Parts of sendmail;
1.5 Basic Parts of a Mail Message;
1.6 Basic Roles of sendmail;
1.7 Basic Modes of sendmail;
1.8 The File;
Chapter 2: Download, Build, and Install;
2.1 Vendor Versus Compiling;
2.2 Download the Source;
2.3 What's Where in the Source;
2.4 Build sendmail;
2.5 Install sendmail;
2.6 Pitfalls;
2.7 Build m4 Macro Reference;
Chapter 3: Tune sendmail with Compile-Time Macros;
3.1 Before You Begin, a Checklist;
3.2 To Port, Tune, or Debug;
3.3 Pitfalls;
3.4 Compile-Time Macro Reference;
Chapter 4: Maintain Security with sendmail;
4.1 Why root?;
4.2 The Environment;
4.3 SMTP Probes;
4.4 The Configuration File;
4.5 Permissions;
4.6 The aliases File;
4.7 Forged Mail;
4.8 Security Features;
4.9 Other Security Information;
4.10 Pitfalls;
Chapter 5: Authentication and Encryption;
5.1 Support SMTP AUTH;
5.2 Public Key Cryptography;
5.4 Pitfalls;
Chapter 6: The sendmail Command Line;
6.1 Alternative argv[0] Names;
6.2 Command-Line Switches;
6.3 List of Recipient Addresses;
6.4 Processing the Command Line;
6.5 sendmail's exit( ) Status;
6.6 Pitfalls;
6.7 Alphabetized Command-Line Switches;
Chapter 7: How to Handle Spam;
7.1 The Local_check_ Rule Sets;
7.2 How DNSBL Works;
7.3 Check Headers with Rule Sets;
7.4 Relaying;
7.5 The access Database;
7.6 Spam Suppression Features;
7.7 Pitfalls;
Chapter 8: Test Rule Sets with -bt;
8.1 Overview;
8.2 Configuration Lines;
8.3 Dump a sendmail Macro or Class;
8.4 Show an Item;
8.5 Complex Actions Made Simple;
8.6 Process-Specified Addresses;
8.7 Add Debugging for Detail;
8.8 Batch Rule-Set Testing;
8.9 Pitfalls;
Chapter 9: DNS and sendmail;
9.1 Overview;
9.2 How sendmail Uses DNS;
9.3 Set Up MX Records;
9.4 How to Use dig;
9.5 Pitfalls;
Chapter 10: Build and Use Companion Programs;
10.1 The Build Script;
10.2 The editmap Program;
10.3 The mail.local Delivery Agent;
10.4 The mailstats Program;
10.5 The makemap Program;
10.6 The praliases Program;
10.7 The rmail Delivery Agent;
10.8 The smrsh Program;
10.9 The vacation Program;
10.10 Pitfalls;
Chapter 11: Manage the Queue;
11.1 Overview of the Queue;
11.2 Parts of a Queued Message;
11.3 Using Multiple Queue Directories;
11.4 Queue Groups (V8.12 and Later);
11.5 Bogus qf Files;
11.6 Printing the Queue;
11.7 How the Queue Is Processed;
11.8 Cause Queues to Be Processed;
11.9 Process Alternative Queues;
11.10 Queue Quarantining;
11.11 Pitfalls;
11.12 The qf File Internals;
Chapter 12: Maintain Aliases;
12.1 The aliases(5) File;
12.2 Forms of Alias Delivery;
12.3 Write a Delivery Agent Script;
12.4 Special Aliases;
12.5 The aliases Database;
12.6 Prevent Aliasing with -n;
12.7 Pitfalls;
Chapter 13: Mailing Lists and ~/.forward;
13.1 Internal Mailing Lists;
13.2 :include: Mailing Lists;
13.3 Defining a Mailing List Owner;
13.4 Exploder Mailing Lists;
13.5 Problems with Mailing Lists;
13.6 Mail List Etiquette;
13.7 Packages That Help;
13.8 The User's ~/.forward File;
13.9 Pitfalls;
Chapter 14: Signals, Transactions, and Syslog;
14.1 Signal the Daemon;
14.2 Log Transactions with -X;
14.3 Log with syslog;
14.4 Pitfalls;
14.5 Other Useful Logging;
14.6 Alphabetized syslog Equates;
Chapter 15: Debug sendmail with -d;
15.1 The Syntax of -d;
15.2 The Behavior of -d;
15.3 Interpret the Output;
15.4 The -D Debug File Switch;
15.5 Table of All -d Categories;
15.6 Pitfalls;
15.7 Reference for -d in Numerical Order;
Configuration Reference;
Chapter 16: Configuration File Overview;
16.1 Overall Syntax;
16.3 V8 Comments;
16.4 Continuation Lines;
16.5 The V Configuration Command;
16.6 Pitfalls;
Chapter 17: Configure with m4;
17.1 The m4 Preprocessor;
17.2 Configure with m4;
17.3 m4 Macros by Function;
17.4 Masquerading;
17.5 Relays;
17.6 UUCP Support;
17.7 Pitfalls;
17.8 Configuration File Feature Reference;
Chapter 18: The R (Rules) Configuration Command;
18.1 Why Rules?;
18.2 The R Configuration Command;
18.3 Tokenizing Rules;
18.4 The Workspace;
18.5 The Behavior of a Rule;
18.6 The LHS;
18.7 The RHS;
18.8 Pitfalls;
18.9 Rule Operator Reference;
Chapter 19: The S (Rule Sets) Configuration Command;
19.1 The S Configuration Command;
19.2 The Sequence of Rule Sets;
19.3 The canonify Rule Set 3;
19.4 The final Rule Set 4;
19.5 The parse Rule Set 0;
19.6 The localaddr Rule Set 5;
19.7 Rule Sets 1 and 2;
19.8 Pitfalls;
19.9 Policy Rule Set Reference;
Chapter 20: The M (Mail Delivery Agent) Configuration Command;
20.1 The M Configuration Command;
20.2 The Symbolic Delivery Agent Name;
20.3 The mc Configuration Syntax;
20.4 Delivery Agents by Name;
20.5 Delivery Agent Equates;
20.6 How a Delivery Agent Is Executed;
20.7 Pitfalls;
20.8 Delivery Agent F= Flags;
Chapter 21: The D (Define a Macro) Configuration Command;
21.1 Preassigned sendmail Macros;
21.2 Command-Line Definitions;
21.3 Configuration-File Definitions;
21.4 Macro Names;
21.5 Macro Expansion: $ and $&
21.6 Macro Conditionals: $?, $|, and $.;
21.7 Macros with mc Configuration;
21.8 Pitfalls;
21.9 Alphabetized sendmail Macros;
Chapter 22: The C and F (Class Macro) Configuration Commands;
22.1 Class Configuration Commands;
22.2 Access Classes in Rules;
22.3 Classes with mc Configuration;
22.4 Internal Class Macros;
22.5 Pitfalls;
22.6 Alphabetized Class Macros;
Chapter 23: The K (Database-Map) Configuration Command;
23.1 Enable at Compile Time;
23.2 The K Configuration Command;
23.3 The K Command Switches;
23.4 Use $( and $) in Rules;
23.5 Database Maps with mc Configuration;
23.6 Pitfalls;
23.7 Alphabetized Database-Map Types;
Chapter 24: The O (Options) Configuration Command;
24.1 Overview;
24.2 Command-Line Options;
24.3 Configuration File Options;
24.4 Options in the mc File;
24.5 Alphabetical Table of All Options;
24.6 Option Argument Types;
24.7 Interrelating Options;
24.8 Pitfalls;
24.9 Alphabetized Options;
Chapter 25: The H (Headers) Configuration Command;
25.1 Overview;
25.2 Header Names;
25.3 Header Field Contents;
25.4 'flags' in Header Definitions;
25.5 Rules Check Header Contents;
25.6 Header Behavior in conf.c;
25.7 Headers and mc Configuration;
25.8 Headers by Category;
25.9 Forwarding with Re-Sent Headers;
25.10 Precedence;
25.11 Pitfalls;
25.12 Alphabetized Header Reference;
Chapter 26: The X (Milters) Configuration Command;
26.1 Create Milter Support;
26.2 Add Configuration Support;
26.3 Build a Milter;
26.4 Pitfalls;
26.5 smfi_ Routine Reference;
26.6 xxfi_ Routine Reference;
The mc Configuration Macros and Directives;
What's New Since Edition 3;
Chapter 1, Some Basics;
Chapter 2, Download, Build, and Install;
Chapter 3, Tune sendmail with Compile-Time Macros;
Chapter 4, Maintain Security with sendmail;
Chapter 5, Authentication and Encryption;
Chapter 6, The sendmail Command Line;
Chapter 7, How to Handle Spam;
Chapter 8, Test Rule Sets with -bt;
Chapter 9, DNS and sendmail;
Chapter 10, Build and Use Companion Programs;
Chapter 11, Manage the Queue;
Chapter 12, Maintain Aliases;
Chapter 13, Mailing Lists and ~/.forward;
Chapter 14, Signals, Transactions, and Syslog;
Chapter 15, Debug sendmail with -d;
Chapter 16, Configuration File Overview;
Chapter 17, Configure with m4;
Chapter 18, The R (Rules) Configuration Command;
Chapter 19, The S (Rule Sets) Configuration Command;
Chapter 20, The M (Mail Delivery Agent) Configuration Command;
Chapter 21, The D (Define a Macro) Configuration Command;
Chapter 22, The C and F (Class Macro) Configuration Commands;
Chapter 23, The K (Database-Map) Configuration Command;
Chapter 24, The O (Options) Configuration Command;
Chapter 25, The H (Headers) Configuration Command;
Chapter 26, The X (Milters) Configuration Command;
The checkcompat( ) Function;
How checkcompat( ) Works;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)