Est. 1983 Advanced

Sendmail

The pioneering Unix mail transfer agent whose cryptic rule-based configuration file became a domain-specific language for rewriting and routing email addresses

Created by Eric Allman

Paradigm Declarative, Rule-based (address-rewriting rulesets)
Typing Untyped (token streams)
First Appeared 1983
Latest Version Sendmail 8.18.2 (2025)

Sendmail is one of the oldest and most influential mail transfer agents (MTAs) on the Internet - the software that accepts, routes, and delivers email between servers. But Sendmail earns a place in an encyclopedia of languages for a different reason: its configuration file, sendmail.cf, is a genuine domain-specific language. Built around terse address-rewriting rulesets, it pattern-matches and transforms email addresses token by token, and its famously cryptic syntax became legendary among system administrators as some of the most impenetrable - and powerful - configuration ever written.

History & Origins

Sendmail was created by Eric Allman at the University of California, Berkeley. Its story begins with an earlier program of his called delivermail, which shipped in 1979 with 4.0 and 4.1 BSD Unix. delivermail was a relatively simple program that knew how to hand mail off to a fixed set of delivery mechanisms.

The late 1970s and early 1980s saw an explosion of incompatible network types - the ARPANET, UUCP, BerkNet, and others - each with its own addressing conventions. A single message might need to cross several of these networks, each requiring its address to be rewritten into a different form. delivermail’s hard-coded approach could not keep up.

Allman’s response was to evolve delivermail into Sendmail, a far more flexible program whose routing and rewriting behavior was driven entirely by a configuration file rather than by compiled-in code. Sendmail shipped with 4.1c BSD in 1983, the first BSD release to include the TCP/IP networking stack that would come to define the Internet. By making mail handling configurable rather than fixed, Sendmail could adapt to whatever new addressing schemes the rapidly changing network world threw at it.

Fragmentation and Reunification

Because Sendmail was open and widely distributed, it spawned numerous variants during the 1980s and early 1990s. In 1987, Lennart Lovstrand at the University of Linkoping in Sweden produced the IDA enhancements, which added dbm database lookups and separate rewriting of message headers versus the SMTP envelope. Vendors such as Sun and HP shipped their own modified versions, and other community forks (notably KJS) appeared.

This fragmentation was eventually healed by Sendmail V8, a major rewrite begun by Allman that consolidated the best ideas from IDA, KJS, and the vendor trees into a single canonical codebase. Sendmail V8 was distributed with 4.4BSD around 1993, and the 8.x version numbering scheme it introduced is still in use today.

The Configuration Language

What makes Sendmail relevant as a language is sendmail.cf. Rather than a list of key = value settings, the file is a program written in a specialized rewriting language. Each line begins with a single command letter:

CommandPurpose
DDefine a macro
C / FDefine a class (set of values), literally or from a file
OSet an option
SBegin a ruleset (numbered or named)
RDefine a rewriting rule within the current ruleset
MDefine a mailer (delivery agent)
KDefine a keyed database map

The heart of the language is the rewriting rule (R). Each rule has three tab-separated fields - a left-hand side (a pattern), a right-hand side (a replacement template), and an optional comment:

# A rewriting rule: pattern  replacement  comment
R$+ @ $+        $@ $1 < @ $2 >    focus the host part
R$* < @ $j > $*  $1 $2            strip the local host name

Addresses are first broken into tokens, then matched against patterns built from special operators:

  • $+ matches one or more tokens
  • $* matches zero or more tokens
  • $- matches exactly one token
  • $=x matches any token in class x
  • $1, $2, … on the right-hand side refer back to what the corresponding pattern operator matched

Rules are grouped into rulesets, and a ruleset can call another ($>n) like a subroutine, loop by re-applying itself, or terminate rewriting with control operators such as $@ (return immediately) and $# (select a mailer for final delivery). The result is, in effect, a small declarative rewriting machine - often described as Turing-complete in practice and notoriously difficult to read.

Why the m4 Layer Exists

Hand-writing sendmail.cf was so error-prone that the project introduced a higher-level configuration system built on the m4 macro processor. Administrators write a compact .mc file using readable macros, and m4 expands it into the low-level .cf rules:

divert(-1)
include(`/usr/share/sendmail-cf/m4/cf.m4')
OSTYPE(`linux')dnl
FEATURE(`use_cw_file')dnl
MAILER(`local')dnl
MAILER(`smtp')dnl

This two-tier design - a friendly macro language compiling down to the raw rewriting language - is itself a notable piece of language engineering, and for most modern installations the .mc file is the only configuration an administrator ever touches directly.

Design Philosophy

Sendmail reflects the pragmatic, do-everything ethos of early Unix networking:

  • Configuration as a program - rather than anticipating every addressing scenario in code, Sendmail exposes a rewriting language so operators can teach it new behaviors.
  • Maximum flexibility - the rule engine can express almost any address transformation, which is precisely why Sendmail survived decades of changing mail standards.
  • A single monolithic agent - classic Sendmail handles receiving, queuing, routing, and delivery in one large privileged process.

That last point became its greatest weakness. Sendmail’s size, complexity, and the elevated privileges of its monolithic design made it a recurring source of high-profile security vulnerabilities - most famously as one of the vectors exploited by the 1988 Morris Worm. The difficulty of safely configuring sendmail.cf compounded the risk.

Influence and the Reaction Against It

Sendmail’s complexity and security history directly inspired a generation of replacement MTAs designed around the opposite philosophy. qmail (Daniel J. Bernstein) and Postfix (Wietse Venema) were built as collections of small, separated, lower-privilege programs explicitly to avoid Sendmail’s monolithic risks, while Exim offered a more approachable single-binary alternative with a cleaner configuration model. Each of these can trace its motivating design decisions to the experience of running and securing Sendmail.

Current Relevance

Sendmail’s share of the mail-server market has declined dramatically from its 1990s dominance, as administrators migrated to Postfix, Exim, and cloud email services. Independent surveys in recent years have placed Sendmail at a low single-digit percentage of detected mail servers, a far cry from the roughly 80% estimated in 1996.

Yet the project remains alive. After Eric Allman and Greg Olson founded Sendmail, Inc. in 1998 to commercialize the software, the company was acquired by Proofpoint, Inc. on October 1, 2013. The open-source codebase continues to be maintained, with Sendmail 8.18.2 released on December 27, 2025. Sendmail still ships in many Unix and Linux package repositories and runs in long-lived production environments where its rewriting flexibility remains valued.

Why It Matters

Sendmail is a landmark for two reasons. As infrastructure, it was the workhorse that carried much of the Internet’s email through its formative decades - one of the programs that genuinely “ran the Internet.” As a language, sendmail.cf is a striking example of an embedded domain-specific language: a complete, pattern-based rewriting system buried inside a configuration file, expressive enough to handle the chaos of real-world email addressing and arcane enough to become an enduring piece of system-administration folklore.

Its lasting lesson is double-edged. Sendmail proved how much power a well-designed configuration language can give operators - and, through the wave of simpler, safer MTAs it provoked, it also demonstrated the costs of complexity and the value of designing for security and clarity from the start.

Learning Resources

Books

  • sendmail by Bryan Costales with Eric Allman (O’Reilly) - the definitive, encyclopedic reference, often called “the bat book”
  • sendmail Cookbook by Craig Hunt (O’Reilly)

Online

Sendmail endures as proof that a configuration file can be a programming language in its own right - and that the line between “settings” and “software” is far blurrier than it first appears.

Timeline

1979
Eric Allman's delivermail, the direct precursor to Sendmail, ships with 4.0 and 4.1 BSD Unix
1983
Sendmail, evolved from delivermail by Eric Allman at UC Berkeley, ships with 4.1c BSD - the first BSD release to include TCP/IP networking
1987
Lennart Lovstrand of the University of Linkoping, Sweden develops the influential IDA enhancements to BSD Sendmail, adding dbm database support and separate header/envelope rewriting
1993
Sendmail V8 (8.1), a major rewrite consolidating the fragmented vendor and IDA/KJS variants, is distributed with 4.4BSD (approximate)
1996
At its peak, roughly 80% of the publicly reachable mail servers on the Internet are estimated to run Sendmail
1998
Eric Allman and Greg Olson co-found Sendmail, Inc. in Emeryville, California to commercialize the software while continuing the open-source release
2013
Proofpoint, Inc. acquires Sendmail, Inc. on October 1, 2013 for approximately $23 million in cash
2024
Sendmail 8.18.1 released on January 31, 2024
2025
Sendmail 8.18.2 released on December 27, 2025, the latest stable version as of mid-2026

Notable Uses & Legacy

Early Internet Mail Backbone

Through the 1990s Sendmail carried a large share of the world's email; by 1996 an estimated 80% of publicly reachable mail servers ran it, making its configuration language one of the most consequential pieces of infrastructure on the early Internet.

BSD and Unix Systems

Sendmail shipped as the default mail transfer agent (MTA) bundled with BSD Unix and many commercial Unix variants, so administering Unix mail meant editing sendmail.cf rulesets.

Universities and ISPs

Academic departments and internet service providers relied on Sendmail to route and deliver high volumes of mail, often writing custom rewriting rules to handle local addressing schemes and relays.

Linux Distributions

Sendmail was historically the default or prominently packaged MTA on many Linux distributions, including early Red Hat releases, before lighter-weight alternatives gained popularity.

Proofpoint Email Products

Following its 2013 acquisition, Proofpoint continues to maintain the open-source Sendmail and incorporates the technology into enterprise email protection and gateway products.

Language Influence

Influenced By

delivermail

Influenced

Postfix qmail Exim

Running Today

Run examples using the official Docker image:

docker pull
Last updated: