# Sendmail

**Sendmail** 是一种邮件传输代理（MTA），即负责将电子邮件从一处路由到另一处的软件，最初由埃里克·奥尔曼（Eric Allman）于20世纪80年代初在加州大学伯克利分校编写<sup>[1](https://linux.omnipotent.net/article/12508-print.html)</sup><sup> • </sup><sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup>。它随BSD Unix一同分发，成为联网UNIX机器上的主流邮件系统，并在此后多年间是互联网上使用最广泛的MTA<sup>[3](https://ptacts.uspto.gov/ptacts/public-informations/petitions/1464039/download-documents?artifactId=_ECRg-ibtQJTJBSRnQWUT0HUANggiHZOXl1u0lCupnCS_X-iCiZD4ho)</sup><sup> • </sup><sup>[4](https://seclists.org/cert/2003/12)</sup>。

| 关键事实 | 详情 |
|---|---|
| 作者 | 埃里克·奥尔曼，当时是加州大学伯克利分校的研究生，同时也是该校的程序员<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup> |
| 起源 | 最初名为delivermail（1981年），在伯克利的ARPA合同下加入SMTP支持后更名为sendmail；随4.2BSD以sendmail之名发布<sup>[1](https://linux.omnipotent.net/article/12508-print.html)</sup><sup> • </sup><sup>[3](https://ptacts.uspto.gov/ptacts/public-informations/petitions/1464039/download-documents?artifactId=_ECRg-ibtQJTJBSRnQWUT0HUANggiHZOXl1u0lCupnCS_X-iCiZD4ho)</sup> |
| 配置 | 主配置文件为/etc/mail/sendmail.cf，由.mc源文件经m4宏处理器生成<sup>[5](https://www.sendmail.org/~ca/email/doc8.12/op-sh-1.html)</sup> |
| 著名事件 | 莫里斯蠕虫（1988年11月）部分通过sendmail的调试模式传播，感染了约6000台机器，约占当时互联网的10%<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup> |
| 商业历史 | Sendmail公司于1998年3月成立；2013年被Proofpoint收购<sup>[1](https://linux.omnipotent.net/article/12508-print.html)</sup><sup> • </sup><sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup> |
| 安全记录 | 从20世纪90年代到21世纪初，CERT安全公告源源不断，包括2003年和2006年的远程代码执行漏洞<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup><sup> • </sup><sup>[4](https://seclists.org/cert/2003/12)</sup><sup> • </sup><sup>[6](https://cert.ssi.gouv.fr/avis/CERTA-2006-AVI-124/)</sup> |

## 起源与历史

Sendmail源于一个本地问题。奥尔曼当时在一台PDP-11上从事INGRES数据库项目，该机器获得了ARPANet连接，但只有两条TTY线路；许多员工都想使用，主要是为了发邮件。他的解决方案是delivermail，一个在不同网络互联的系统之间转发消息的程序，从FTP投递的邮件到UUCP<sup>[7](https://fperrin.net/EuroBSDcon/sendmail.html)</sup>。当伯克利获得ARPA合同，为当时正在设计、用以取代ARPANet的网络开发VAX软件时，奥尔曼加入了SMTP客户端和服务器支持，并将程序更名为sendmail<sup>[1](https://linux.omnipotent.net/article/12508-print.html)</sup>。到1982年，sendmail已成为BSD的一部分，随着BSD的分发而广泛传播，恰逢ARPANet成长为互联网<sup>[8](https://www.salon.com/1998/11/30/feature_248/)</sup>。

该程序自1980年以来以多种形式存在。它在4BSD和4.1BSD中以delivermail之名发布，在4.2BSD中以sendmail之名发布，并迅速成为联网UNIX系统的主流邮件系统<sup>[3](https://ptacts.uspto.gov/ptacts/public-informations/petitions/1464039/download-documents?artifactId=_ECRg-ibtQJTJBSRnQWUT0HUANggiHZOXl1u0lCupnCS_X-iCiZD4ho)</sup>。奥尔曼于1987年停止主要开发工作，1991年恢复活跃开发，部分动机是伯克利希望转换为子域寻址结构，以及CSRG要求为4.4BSD提供更新的邮件系统<sup>[3](https://ptacts.uspto.gov/ptacts/public-informations/petitions/1464039/download-documents?artifactId=_ECRg-ibtQJTJBSRnQWUT0HUANggiHZOXl1u0lCupnCS_X-iCiZD4ho)</sup>。奥尔曼在1994年论文中描述的第8版，整合了1987年至1991年空档期内大量涌现的厂商和志愿者变体<sup>[3](https://ptacts.uspto.gov/ptacts/public-informations/petitions/1464039/download-documents?artifactId=_ECRg-ibtQJTJBSRnQWUT0HUANggiHZOXl1u0lCupnCS_X-iCiZD4ho)</sup>。

## 配置

Sendmail读取运行时配置文件/etc/mail/sendmail.cf，该文件描述了它所知道的邮件程序、如何解析地址、如何重写消息头以及相关设置<sup>[5](https://www.sendmail.org/~ca/email/doc8.12/op-sh-1.html)</sup>。由于该文件的语法难以直接编写，发行版的配置文件由m4宏处理器处理，因此管理员编写一个小的.mc源文件，并将其编译为sendmail.cf<sup>[9](https://sendmail.org/~ca/email/README.cf.8.8.html)</sup>。从8.12版开始，sendmail根据运行模式使用两个配置文件：用于初始邮件提交的submit.cf和用于传输操作的sendmail.cf<sup>[5](https://www.sendmail.org/~ca/email/doc8.12/op-sh-1.html)</sup>。

这种配置的复杂性反映了该程序所解决的问题：不同的寻址格式、协议转换、路由决策、头部重写和别名扩展。收件人地址由规则集0解析为邮件程序、主机和地址三元组，可设别名的地址在别名数据库中查找，该数据库以文本形式维护于/etc/mail/aliases，并以数据库形式保存以提高性能<sup>[10](https://sendmail-doc.sendmaid.org/)</sup>。

## 安全记录

由于Sendmail在暴露于互联网的服务器上以root身份运行，处理来自不可信方的复杂输入，且以C语言编写，攻击者经常将其选为目标。<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup> 最著名的早期利用事件发生在1988年11月，[莫里斯蠕虫](https://www.edgepedia.org/zh/morris-worm)利用了一个允许远程命令执行的sendmail调试模式作为其传播手段之一；该蠕虫感染了约6000台机器，约占当时互联网的10%<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup>。

20世纪90年代和21世纪初，CERT安全公告源源不断，涵盖缓冲区溢出、格式化字符串漏洞和竞争条件<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup>。有记录的例子包括：

- **CA-2003-12（2003年3月）**：地址解析代码中存在可远程利用的缓冲区溢出，该代码未充分检查电子邮件地址的长度；一个特制的地址触发栈溢出，可能允许以sendmail守护进程的权限（通常为root）执行任意代码。该漏洞由安全研究员米哈尔·扎莱夫斯基（Michal Zalewski）发现，影响8.12.9之前的开源sendmail版本以及商业产品Sendmail Switch和Sendmail for NT<sup>[4](https://seclists.org/cert/2003/12)</sup>。
- **CERTA-2001-AVI-085（2001年8月）**：一个影响8.11.0至8.11.5版本、可将本地权限提升至root的漏洞，在8.11.6中修复；利用代码已公开，尽管该漏洞不可远程利用<sup>[11](https://www.cert.ssi.gouv.fr/avis/CERTA-2001-AVI-085/)</sup>。
- **CERTA-2006-AVI-124（2006年3月）**：sendmail处理异步消息时存在漏洞，允许远程攻击者执行任意代码，影响8.12.x分支的8.12.11及更早版本和8.13.x分支的8.13.5及更早版本<sup>[6](https://cert.ssi.gouv.fr/avis/CERTA-2006-AVI-124/)</sup>。
- **CA-2002-28（2002年）**：确认部分sendmail源代码分发副本已被入侵者修改，包含木马<sup>[12](https://linuxsecurity.com/news/hackscracks/sendmail-trojan-horse)</sup>。
- **CVE-2006-4434（2006年8月）**：8.13.8之前的Sendmail中存在释放后使用漏洞，可通过超长头部行导致远程拒绝服务<sup>[13](https://portal.vyprsec.ai/vendors/sendmail/cves)</sup>。

一个漏洞数据库追踪了自1999年9月以来Sendmail的22个CVE，其中没有一个进入CISA已知被利用漏洞目录<sup>[14](https://cve.tools/vendors/sendmail)</sup>。

## 竞争对手与商业化

Sendmail的安全问题成为开发其他MTA的主要动因。很大程度上受sendmail安全记录的驱动，丹·伯恩斯坦（Dan Bernstein）编写了qmail，而在IBM研究院，维策·维内马（Wietse Venema）将安全作为首要关注点，设计了Postfix；在很大程度上，每个项目都是作为对sendmail弱点的反应而出现的<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup>。Postfix在设计时将安全作为基本要求而非事后考虑，使用多个以最小权限运行的小程序和一个chroot监狱，与sendmail本质上的单体设计形成对比<sup>[15](https://www.postfix.org/linuxjournal.200010/4241.html)</sup>。

1998年3月，奥尔曼与人共同创立了Sendmail公司，围绕该软件提供商业支持和产品<sup>[1](https://linux.omnipotent.net/article/12508-print.html)</sup><sup> • </sup><sup>[8](https://www.salon.com/1998/11/30/feature_248/)</sup>。该公司于2013年被Proofpoint收购<sup>[2](https://emailcloud.com/timeline/sendmail-history/)</sup>。

## References

1. [LCDB: Interview with Eric Allman, CTO of Sendmail Inc.](https://linux.omnipotent.net/article/12508-print.html)
2. [Sendmail History, EmailCloud](https://emailcloud.com/timeline/sendmail-history/)
3. [Eric Allman, Changes in Sendmail Version 8](https://ptacts.uspto.gov/ptacts/public-informations/petitions/1464039/download-documents?artifactId=_ECRg-ibtQJTJBSRnQWUT0HUANggiHZOXl1u0lCupnCS_X-iCiZD4ho)
4. [CERT Advisory CA-2003-12 Buffer Overflow in Sendmail](https://seclists.org/cert/2003/12)
5. [Sendmail BASIC INSTALLATION (8.12), sendmail.org](https://www.sendmail.org/~ca/email/doc8.12/op-sh-1.html)
6. [CERT-FR, Avis CERTA-2006-AVI-124, Vulnérabilité de Sendmail](https://cert.ssi.gouv.fr/avis/CERTA-2006-AVI-124/)
7. [sendmail — history and design, talk by Eric Allman](https://fperrin.net/EuroBSDcon/sendmail.html)
8. [You've got sendmail, Salon (1998)](https://www.salon.com/1998/11/30/feature_248/)
9. [New Sendmail Configuration Files (8.8), sendmail.org](https://sendmail.org/~ca/email/README.cf.8.8.html)
10. [Sendmail Installation and Operation Guide](https://sendmail-doc.sendmaid.org/)
11. [CERT-FR, Avis CERTA-2001-AVI-085, Vulnérabilité dans sendmail](https://www.cert.ssi.gouv.fr/avis/CERTA-2001-AVI-085/)
12. [CERT Advisory CA-2002-28 Sendmail Trojan Horse Remote Access Threat](https://linuxsecurity.com/news/hackscracks/sendmail-trojan-horse)
13. [Sendmail CVEs, VYPR Vulnerability Intelligence](https://portal.vyprsec.ai/vendors/sendmail/cves)
14. [Sendmail Vulnerabilities & CVEs, CVE Tools](https://cve.tools/vendors/sendmail)
15. [Using Postfix for Secure SMTP Gateways, Linux Journal](https://www.postfix.org/linuxjournal.200010/4241.html)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Operating systems › Unix-like and Linux › Unix, BSD, and kernel internals

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/sendmail

English original: https://www.edgepedia.org/sendmail
