1. 介绍
1.1. 适合阅读本文的读者
Life with qmail 的目标读者是那些对qmail有兴趣, 却被归类于业余爱好者, 新手的人, 那些在一台空闲(原文为: a spare PC 译者注)PC机上操作Linux, 希望日后成为经验丰富的系统管理员或邮件系统管理员的人写作的. 如果你发现文章中有缺陷或者不清楚的地方, 请用电子邮件告诉我. (英文) lwq at sill dot org. (译者的电子邮件: Jerry underline ZhiJun@21cn-dot-com 译者注).Life with qmail is aimed at everyone interested in running qmail, from the rank amateur (newbie) who just installed Linux on a spare PC all the way up to the experienced system administrator or mail administrator. If you find it lacking or unclear, please let me know. Send comments to lwq@sill.org.
各种不同的来源存在着丰富的 qmail相关信息. 其中一些是以新手为目标, 另外一些假定读者具有比较多的经验, Life with qmail 就是一篇试图成为"胶水"性质的文章, 集合这些信息为一体, 不过读者必须首先掌握下面这些基础知识: There's a wealth of information available on qmail from a variety of sources. Some is targeted to newbies, some assumes that the reader is more experienced. Life with qmail is an attempt to "glue" this information into a single source, filling in some of the cracks and assuming only that the reader has basic skills such as:
- 在UNIX环境下熟练的操作文件和目录的能力 Manipulating files/directories under UNIX
- 会使用web浏览器和FTP客户端软件 Operating a web browser or FTP client
- 能够读懂下面的使用方法 Following directions
1.2. 什么是 qmail?
qmail是一个因特网邮件传送代理, (英文: Mail Transfer Agent, 简写为MTA, 译者注) 它运行在UNIX兼容系统下, 是一个直接代替UNIX下 Sendmail软件的邮件传送程序. qmail 使用简单报文传送代理协议 SMTP 传输邮件(Simple Mail Transfer Protocol). qmail is an Internet Mail Transfer Agent (MTA) for UNIX-like operating systems. It's a drop-in replacement for the Sendmail system provided with UNIX operating systems. qmail uses the Simple Mail Transfer Protocol (SMTP) to exchange messages with MTA's on other systems.
注意: 它的名字是 "qmail" , 而不是 "Qmail". Note: The name is "qmail", not "Qmail".
1.3. 为什么用 qmail?
你的操作系统如果包含一个MTA, 很有可能是Sendmail, 而你阅读了下面的文档之后, 你可能想要找一个更好的MTA了. Your operating system included an MTA, probably Sendmail, so if you're reading this document you're probably looking for something better. Some of the advantages of qmail over vendor-provided MTA's include:
1.3.1. 安全
qmail 是面向安全而设计的. Sendmail 的历史上出现过很多严重的安全问题. 在编写Sendmail的时代, 网络是非常友好的地方, 每个在网上交流的人都能够很容易的了解对方, 几乎没有必要为了安全而设计软件, 编写代码. 而现在的因特网对于网络服务器却是险象丛生. Eric Allman, Sendmail的作者, 为了加强Sendmail的安全做了很多工作, 但是无论如何, 除了重新设计, 怎样的修正也不能让Sendmail达到真正的安全. qmail was designed for high security. Sendmail has a long history of serious security problems. When Sendmail was written, the Net was a much friendlier place. Everyone knew everyone else, and there was little need to design and code for high security. Today's Internet is a much more hostile environment for network servers. Sendmail's author, Eric Allman, has done a good job of tightening up the program, but nothing short of a redesign can achieve true security.
1.3.2. 性能
qmail 并行处理邮件传送, 缺省配置情况下, 能够达到20个并行邮件同时传送. qmail parallelizes mail delivery, performing up to 20 deliveries simultaneously, by default.
1.3.3. 可靠性
qmail保证已经接收的新邮件不被丢失, qmail使用一种新的邮箱格式, 其可靠性超过了没有文件锁的NFS存储系统. Once qmail accepts a message, it guarantees that it won't be lost. qmail also supports a new mailbox format that works reliably even over NFS without locking.
1.3.4. 简单Simplicity
qmail 比其他实现同样功能的MTA都要小. qmail is smaller than any other equivalently-featured MTA.
注意: qmail 的正式主页, http://cr.yp.to/qmail.html 有更多的 qmail 特色介绍. Note: The official qmail web page, http://cr.yp.to/qmail.html covers the advantages of qmail more extensively.
1.4. 发展历史History
qmail由 Dan Bernstein (DJB)博士编写, 他的主页 http://cr.yp.to/djb.html . 他现在任职于 Illinois 大学 Chicago 分校数学教授. 它在密码术研究方面的工作, 以及他关于密码术源代码的出版问题对美国政府的诉讼也是很有名的, 关于这次诉讼的新闻详见 http://www.news.com/News/Item/0,4,36217,00.html?owv 或 http://cr.yp.to/export.html 查看关于诉讼的信息. qmail was written by Dan Bernstein (DJB), http://cr.yp.to/djb.html, a math professor now at the University of Illinois in Chicago. Dr. Bernstein is also well known for his work in the field of cryptography and for his lawsuit against the U.S. government regarding the publishing of encryption source code. See http://www.news.com/News/Item/0,4,36217,00.html?owv or http://cr.yp.to/export.html for information regarding the lawsuit.
第一个公开发行的 qmail 版本是1996年1月24日发表的 0.70 beta 版. 第一个 gamma 发行版是在1996年8月1日的0.90版.
The first public release of qmail, beta version 0.70, occurred on
January, 24, 1996. The first gamma release, 0.90, was on August, 1, 1996.
第一个常规发行版本是1.0, 时间是1997年2月20日. 现在使用的1.03版本, 发行于1998年6月15日.
Version 1.0,
the first general release, was announced on February, 20, 1997. The current
version, 1.03, was released on June, 15, 1998.
预期下一个版本将是2.0评估版, 即将在2.0版里面出现的一些新功能可以在http://cr.yp.to/qmail/future.html
找到.
The next release is expected to be an evaluation version of 2.0. Some of
things that might appear in version 2 are covered at http://cr.yp.to/qmail/future.html.
1.5. 特点 Features
qmail 的web页 http://cr.yp.to/qmail.html 列出了非常全面的qmail的特点. 本节即针对这个页面列出的特点予以着重介绍. The qmail web page, http://cr.yp.to/qmail.html, has a comprehensive list of qmail's features. This section is based heavily on that list.
1.5.1. 安装 Setup
- 自动适应于UNIX的各种版本Automatic adaptation to your UNIX variant--no porting needed
- 自动适应于单主机配置Automatic per-host configuration
- 快速安装--不必作大量的配置工作Quick installation--no big list of decisions to make
1.5.2. 安全 Security
- 地址, 文件以及程序之间分隔清晰Clear separation between addresses, files, and programs
- 最少限度的应用setuid方式Minimization of setuid code
- 最少限度的应用root权限Minimization of root code
- 五个不同安全权限分级运行(指利用五个分隔的uid运行qmail的不同功能模块. 译者注)Five-way trust partitioning--security in depth
- 可选的邮件单向散列计算功能, 包括整个邮件内容的hash计算等功能. (参考 附录 E 的什么是 QUEUE EXTRA?) Optional logging of one-way message hashes, entire message contents, etc. (See What is QUEUE_EXTRA? in Appendix E.)
1.5.3. 邮件结构 Message construction
- 符合RFC 822 和RFC 1123 标准. RFC 822 and RFC 1123 compliant
- 邮件地址组的完整支持. Full support for address groups
- 自动转换旧格式地址为RFC 822 格式. Automatic conversion of old-style address lists to RFC 822 format
- 支持sendmail命令, 与目前的邮件用户代理兼容. sendmail command for compatibility with current user agents
- 仅受限于内存大小的长邮件头支持. Header line length limited only by memory
- 主机伪装(参见 defaulthost)Host masquerading (See defaulthost)
- 用户伪装(参见 MAILUSER和 MAILHOST)User masquerading (See MAILUSER and MAILHOST)
- 自动生成邮件跟踪列表(参见 QMAILMFTFILE ) Automatic Mail-Followup-To creation (See QMAILMFTFILE)
1.5.4. SMTP 服务 SMTP service
- 兼容 RFC 821, RFC 1123, RFC 1651, RFC 1652, 和 RFC 1854 标准 RFC 821, RFC 1123, RFC 1651, RFC 1652, and RFC 1854 compliant
- 全 8-bit 操作(qmail直接对邮件进行8bit操作. 译者注) 8-bit clean
- 支持 RFC 931/1413/ident/TAP 回查--用来跟踪垃圾邮件和伪造邮件 RFC 931/1413/ident/TAP --can help track spammers/forgers
- 转信控制--阻止未授权的外来转信请求. Relay control--stops unauthorized relaying by outsiders
- 转信控制与别名无冲突. No interference between relay control and aliases
- 自动识别本地IP地址. Automatic recognition of local IP addresses
- 每缓冲超时Per-buffer timeouts
- 跃点计算Hop counting
- 并行访问限制(通过 ucspi-tcp) Parallelism limit (via ucspi-tcp)
- 对已知的垃圾邮件发送者, 拒绝连接(通过 ucspi-tcp) Refusal of connections from known abusers (via ucspi-tcp)
- 支持授权用户转信和消息重写 Relaying and message rewriting for authorized clients
- 可选的黑洞名单(Realtime Blackhole List, RBL)和开放转信系统修正(Open Relay Behavior-modification System, ORBS) 支持 Optional RBL/ORBS support (via rblsmtpd)
1.5.5. 队列管理 Queue management
- 对加入队列的邮件即时处理 Instant handling of messages added to queue
- 并行处理限定 Parallelism limits
- 分割队列目录--队列很大时不降低处理速度 Split queue directory--no slowdown when queue gets big
- 二次幂重试时间表排定算法--队列内越陈旧的消息得到的发送机会相对新消息越小 (参考 附录 E) Quadratic retry schedule--old messages tried less often (see Appendix E)
- 每个邮件独立的重试时间表 Independent message retry schedules
- 自动安全队列--系统崩溃情况下不丢失邮件. Automatic safe queueing--no loss of mail if system crashes
- 自动每邮件接收者检查 Automatic per-recipient checkpointing
- 自动队列清除 Automatic queue cleanups
- 队列观察(参看 qmail-qread) Queue viewing (See qmail-qread)
- 详细的传送过程分析 (通过 qmailanalog) Detailed delivery statistics (via qmailanalog)
1.5.6. 邮件反弹 Bounces
- QSBMF反弹邮件--包括机器易读和人类易读两种格式 QSBMF bounce messages--both machine-readable and human-readable
- HCMSSC 支持--不受语言约束的 RFC 1893 错误代码 HCMSSC support--language-independent RFC 1893 error codes
- 发送两次反弹邮件给系统管理员(postmaster) Double bounces sent to postmaster
1.5.7. 基于域名的邮件路由 Routing by domain
- 支持任意数量的本地主机名(参看 locals) Any number of names for local host (See locals)
- 支持任意数量的虚拟域 (参看 virtualdomains) Any number of virtual domains (See virtualdomains)
- 支持域名通配符 (参看 virtualdomains) Domain wildcards (See virtualdomains)
- 可配置的"percent hack"支持 (参看 percenthack) Configurable "percent hack" support (See percenthack)
- UUCP 钩 (UUCP hook) UUCP hook
1.5.8. SMTP 传输 SMTP delivery
- 兼容 RFC 821, RFC 974, and RFC 1123 RFC 821, RFC 974, and RFC 1123 compliant
- 全8-bit字符支持 8-bit clean
- 对关闭主机自动补偿 Automatic downed host backoffs
- 人工路由--smarthost, localnet, mailertable (参考 smtproutes) Artificial routing--smarthost, localnet, mailertable (See smtproutes)
- 每缓冲超时 per-buffer timeouts
- 被动SMTP队列--对(低速)SLIP/PPP线路的完美支持 (通过 serialmail) Passive SMTP queue--perfect for SLIP/PPP (via serialmail)
- Auto TURN支持 (通过 serialmail) AutoTURN support (via serialmail)
1.5.9. 转发和邮件列表 Forwarding and mailing lists
- 兼容Sendmail的 .forward控制文件(通过 dot-forward). Sendmail .forward compatibility (via dot-forward)
- 散列的转发数据库(通过 fastforward) Hashed forwarding databases (via fastforward)
- 兼容Sendmail的 /etc/aliases 控制文件(通过 fastforward) Sendmail /etc/aliases compatibility (via fastforward)
- 地址通配符 (参见 .qmail-default) Address wildcards (See .qmail-default)
- 邮件列表所有者--自动转移反弹邮件和假期邮件 Mailing list owners--automatically divert bounces and vacation messages
- VERPs--自动邮件列表反弹邮件接收者识别 VERPs--automatic recipient identification for mailing list bounces
- 自动防止循环成环邮件传送, 甚至可以避免对于交叉并联主机的配置方式成环邮件传送 Delivered-To--automatic loop prevention, even across hosts
1.5.10. 本地(邮件)传送 Local delivery
- 支持用户控制的地址分级--任意FRED(Fast Random Enquiry Display 快速随 机询问显示, 译者注) mbox传送 User-controlled address hierarchy--fred controls fred-anything mbox delivery
- 可靠的NFS传输(参见 maildir) Reliable NFS delivery (See maildir)
- 支持用户可控的邮件程序传送, 比如procmail等, (参见 qmail-command) User-controlled program delivery: procmail etc. (See qmail-command)
- 可选的新邮件通知(参见 qbiff) Optional new-mail notification (See qbiff)
- 可选的NRUDT返回收条(参见 qreceipt) Optional NRUDT return receipts (See qreceipt)
- 条件过滤(参见 condredirect 和 bouncesaying) Conditional filtering (See condredirect and bouncesaying)
1.5.11. POP3 服务 POP3 service
- 兼容 RFC 1939 RFC 1939 compliant
- 支持UIDL UIDL support
- 支持TOP TOP support
- APOP钩 APOP hook
- 模块化的密码检查(通过 checkpassword) modular password checking (via checkpassword)
1.6. 相关的软件包 Related packages
qmail遵循经典UNIX哲学: 每个软件工具都要有专一的, 规范良好的功能; 而复杂的功能应该由一系列多个独立的简单工具联合完成, 形成一个"流水线"模式. 另外一种方式是在更为简单的工具上不断的建立和丰富越来越复杂的的功能来完成大量的复杂的功能.qmail follows the classic UNIX philosophy that each tool should perform a single, well-defined function, and complex functions should be built by connecting a series of simple tools into a "pipeline". The alternative is to build more and more complex tools that re-invent much of the functionality of the simpler tools.
qmail并没有拥有所有人要求的任意功能, 这点并不令人惊讶惊讶. 相反的, qmail拥有的是一些实现那些功能的流行的插件(add-ons). 当然了, 许多标准UNIX实用工具也都可以作为插件和qmail协同工作. 下面介绍一些插件: It's not surprising, then, that qmail itself doesn't do everything everyone might want it to do. Here, then, are some of the most popular add-ons written for qmail. Of course, many standard UNIX utilities can also be plugged into qmail.
- dot-forward --一个兼容Sendmail的.forward控制文件的插件 dot-forward--a Sendmail .forward file compatibility add-on
- fastforward -- 一个兼容Sendmail别名数据库的插件 fastforward--a Sendmail alias database compatibility add-on
- ucspi-tcp -- 一个inetd超级服务器的替换程序 ucspi-tcp--an inetd replacement
- daemontools -- 一个管理后台服务程序以及日志的工具套件 daemontools--a set of tools for managing daemons and their logs
- qmailanalog -- 一个qmail日志文件分析工具套件 qmailanalog--a set of qmail log file analysis tools
- serialmail -- 用于低速网络邮件传送的工具 serialmail--tools for mailing over slow networks
- mess822 -- 剖析因特网邮件的工具 mess822--tools for parsing Internet mail messages
- ezmlm -- 一个基于qmail的管理邮件列表的工具 ezmlm--a mailing list manager for qmail
1.7. 体系结构 Architecture
附录 D 介绍了qmail的功能和结构. 简单的说, qmail包含了一系列的程序(模块)来完成不同的任务. Appendix D covers qmail's functional and physical structure. In a nutshell, qmail consists of a series of programs (modules) that perform different tasks.
1.8. 版权许可信息 License
qmail的版权由作者Dan Bernstein所有, qmail没有和用户权利声明一同发布. 在web页面 http://cr.yp.to/softwarelaw.html 上, 作者Dan Bernstein概要陈述了他认为用户在美国版权法下拥有的权利和义务. 在web页 http://cr.yp.to/qmail/dist.html 上描述了作者授权给qmail的源代码分发用户的权利和义务. 二进制发行遵循条款在下面这个web页面上可以找到 http://cr.yp.to/qmail/var-qmail.html. qmail is copyrighted by the author, Dan Bernstein, and is not distributed with a statement of user's rights. In http://cr.yp.to/softwarelaw.html, he outlines what he thinks your rights are under U.S. copyright law. In http://cr.yp.to/qmail/dist.html he grants the right to distribute qmail source code. Binary distributions are allowed under the terms described there and in http://cr.yp.to/qmail/var-qmail.html.
发行权限的最底线: 你可以将qmail用于任何用途, 你可以再次分发未修改的qmail源代码和有资格的var-qmail二进制发行包, 你也可以发行qmail补丁程序. 但是你不能发行修改过的qmail源代码和non-var-qmail二进制发行包. The bottom line is that you can use qmail for any purpose, you can redistribute unmodified qmail source distributions and qualifying var-qmail binary distributions, and you can distribute patches to qmail. You can't distribute modified qmail source code or non-var-qmail binary distributions.
1.9. 和其他MTA相比较 Comparison with other MTA's
这个题目完全可以写一本书啦. 不过可能是很单调乏味的一本. 这里给出一个qmail和其他最常见的UNIX MTA的快速比较表格(中: medium, 高: high, 低: low, 是: yes, 否: no, 插件: addons, 可选的: optional. 译者注) A book could be written about this topic, but it would be tedious reading. Here's a quick comparison of qmail with some of the most common UNIX MTA's.
| MTA | 成熟度 | 安全性 | 特色 | 性能 | 兼容Sendmail | 模块化 |
| qmail | 中 | 高 | 高 | 高 | 插件 | 是 |
| Sendmail | 高 | 低 | 高 | 低 | - | 否 |
| Postfix | 中 | 高 | 中 | 高 | 是 | 是 |
| exim | 中 | 低 | 高 | 中 | 是 | 否 |
| Courier | 低 | 中 | 高 | 中 | 可选的 | 是 |
兼容Sendmail意思是MTA运转是否类似于Sendmail, 从而可以在某种用户透明度上从此MTA和Sendmail之间过渡和切换, 比如.forward控制文件, /etc/aliases文件以及是否传送邮件到目录 /var/spool/mail等等行为. Sendmailish means the MTA behaves like Sendmail in some ways that would make a switch from Sendmail to the alternative MTA more user-transparent, such as the use of .forward files, /etc/aliases, and delivery to /var/spool/mail.
Jonathan de Boyne Pollard 曾经回顾了很多UNIX下的MTA, web页面在http://homepages.tesco.net/~J.deBoynePollard/Reviews/UnixMTSes/ . 另外一个很详细的的比较文章请参考http://www.geocities.com/mailsoftware42/. Jonathan de Boyne Pollard has reviews of many Unix MTAs at http://homepages.tesco.net/~J.deBoynePollard/Reviews/UnixMTSes/. Another detailed comparison is available at http://www.geocities.com/mailsoftware42/.
1.10. 文档 Documentation
1.10.1. man 手册 man pages
qmail发行包包含了完整的man手册. 安装之后, 他们通常位于 /var/qmail/man. 你可能需要自己手动增加这个手册目录路径到你的环境变量MANPATH里面. The qmail distribution comes with a complete set of man pages. After installation, they're in /var/qmail/man. You'll probably need to add that directory to your MANPATH environment variable.
| Shell 解释器 Shell | 命令行 Command |
| Bourne (/bin/sh) | MANPATH=$MANPATH:/var/qmail/man; export MANPATH |
| bash, Korn | export MANPATH=$MANPATH:/var/qmail/man |
| C Shell | setenv MANPATH $MANPATH:/var/qmail/man |
(上面表格为各个不同shell下运行的增加环境变量的命令行格式, 故不予翻译, 用户也可以参考man man来查阅直接指定man的指定目录开关的设定, 在Bourne下, 这个开关一般是 -M.译者注) (修改环境变量之后) 用型如"man name-of-qmail-man-page"的命令格式即可调出相关的手册页面. At this point, commands in the format "man name-of-qmail-man-page" should display the appropriate man page.
也可以访问man手册页面的在线web页面形式, 地址是: The man pages are also available on-line in HTML format from:
注意: qmail的man手册页面承载了大量的信息, 它的写作语言偏重技术术语, 可能相当晦涩难懂, 必须仔细加以研读. 你可能需要通读一遍来熟悉它. 因为很少有重复性的内容, 你必须首先知道里面都写了哪些内容,以及你感兴趣的那些内容在哪里, 否则你可能根本找不到你要的东西. Note: The qmail man pages are loaded with information, but they require careful reading because they're written in a very dense, technical style. You might want to print off a set and read them through once to familiarize yourself with what's there and where it is. Very little information is repeated on multiple pages, so if you don't know where something is covered, it can be hard to find it.
1.10.2. 文档 Docs
qmail发行版包含了一系列文档, 通常安装在/var/qmail/doc目录下. 它们包括以下内容: The qmail distribution includes a series of documents that are installed under /var/qmail/doc. They include:
- FAQ: 常见问题以及回答. FAQ: Frequently Asked Questions, with answers
- INSTALL.* 文件集: 安装文档. INSTALL*: Installation documentation
- PIC.*文件集: 描述了qmail如何完成核心任务的文档. 查找更多相关信息, 请参看附录体系结构. PIC.*: Descriptions of how qmail performs key tasks. See the Architecture appendix for more information.
- 其他几个安装相关文档. Various other installation-related documentation
这些文档也可以在线查看, 请到web页面: These docs are also available on-line from:
1.10.3. 常见问题 FAQs
有两个正式的常见问题(Frequently Asked Questions, FAQ. 附相关回答)文档: There are two official FAQ (Frequently Asked Questions, with answers) documents:
- /var/qmail/doc/FAQ 目录下, 纯文本版本, 以及 /var/qmail/doc/FAQ, the plain text version, and
- web页面FAQ, 地址: http://cr.yp.to/qmail/faq.html. The web FAQ at http://cr.yp.to/qmail/faq.html.
web页面的FAQ更完整一些. The web FAQ is more complete.
1.10.4. 书籍 Books
1.10.4.1. qmail 手册 (英文书名: The qmail Handbook) The qmail Handbook
作者Dave Sill, 也是本文Life with qmail的作者, 曾经为Apress(http://www.apress.com/)出版社撰写了一本qmail书籍. 这本qmail 手册 (英文书名: The qmail Handbook), 包括了本文所有内容, 某些方面更为详细, 同时也介绍了大量的新领域. Dave Sill, the author of Life with qmail, has written a qmail book for Apress (http://www.apress.com/). This book, The qmail Handbook, covers everything in this guide, but goes into much more detail and also covers a lot of new ground.
更多信息, 请参看 http://www.apress.com/catalog/book/1893115402/. 需要定购本书, 请参看 http://www.amazon.com/exec/obidos/ASIN/1893115402/davesill. For more information, see http://www.apress.com/catalog/book/1893115402/. To order this book, see http://www.amazon.com/exec/obidos/ASIN/1893115402/davesill.
1.10.4.2. qmail (英文书名: qmail) qmail
据报道, John Levine为O'Reilly & Associates (http://www.oreilly.com/).出版社写作的一本qmail书籍. John Levine is reportedly writing a qmail book for O'Reilly & Associates (http://www.oreilly.com/).
1.10.4.3. Running qmail (英文书名: Running qmail) Running qmail
作者Richard Blum, Sams出版. 这本书被认为接受了很多qmail的邮件列表里面的不同观点. Richard Blum has written Running qmail, which is published by Sams. This book has received mixed reviews on the qmail mailing list.
定购本书, 请参看 http://www.amazon.com/exec/obidos/ASIN/0672319454/davesill. For more information or to order this book, see http://www.amazon.com/exec/obidos/ASIN/0672319454/davesill.
1.10.5. 邮件列表文档 List archives
qmail的邮件列表, 由Dan Bernstein 维护, 极为有价值的信息来源. web文档保存在以下位置: The qmail e-mail mailing list, maintained by Dan Bernstein, is a valuable source of information. A web archive of the lists messages is kept at:
这个文档的一个搜索引擎位置在: A search engine for the archive is at:
其他web文档可以在以下地址访问到: Other web archives are available at:
大多数关于qmail的问题的答案都可以首先在这个邮件列表的文档里面搜索到. Most questions about qmail can be answered by searching the list archives first.
1.10.6. 其他Web站点 Other Web Sites
- http://cr.yp.to/qmail.html : qmail的正式主页. http://cr.yp.to/qmail.html: the official qmail home page.
- http://www.qmail.org/. qmail的非正式主页. 包含了大量关于功能插件和补丁的信息, 以及很多很棒的关于qmail的web页面的链接. http://www.qmail.org/: the unofficial qmail home page. Contains lots of information about add-ons and patches, and links to many good qmail web pages on other sites.
- http://www.flounder.net/qmail/qmail-howto.html: Adam McKenna 制作的HOWTO.http://www.flounder.net/qmail/qmail-howto.html: Adam McKenna's HOWTO.
1.11. 技术支持 Support
1.11.1. 邮件列表 Mailing lists
下面的这些列表位于主机 list.cr.yp.to. 为了防止被发送垃圾邮件者获取地址, 我没有使用完整有效的邮件地址, 以及"mailto"格式的URL.(这里隐去了真实的listname, 具体请参看qmail的正式主页介绍或者查看1.11.1.节, 也就是本节的几个小节的带有下划线的英文标题名字, 译者注) The following lists reside on list.cr.yp.to. In order to prevent harvesting of e-mail addresses by spammers, I'm avoiding the use of complete, valid addresses and "mailto" URL's.
这些邮件列表由ezmlm管理, 使用不同的地址实现不同的功能. The lists are managed by ezmlm, which uses different addresses to perform different functions:
- listname@list.cr.yp.to: 订阅地址. 发送到这个地址的邮件将会被发送给列表的所有用户. 请不要发送订阅和退订要求到这个地址, 这样作是无效的, 而且还会打扰其他订阅者. listname@list.cr.yp.to: the submission address. Messages sent here go out to all members of the list. Do not send subscribe/unsubscribe requests here: they won't work, and they'll annoy the subscribers.
- listname-help@list.cr.yp.to: 这是"帮助"地址. 发送邮件到这个地址将会返回使用信息. listname-help@list.cr.yp.to: the "help" address. Returns a list of command addresses and general usage information.
- listname-subscribe: 发送空消息到这个地址订阅列表. listname-subscribe: send a blank message here to subscribe.
- listname-unsubscribe: 发送空消息到这个地址退订列表. listname-unsubscribe: send a blank message here to unsubscribe.
举例, 一个订阅或者退订地址, 比如 joe@example.com, 发送邮件到这个地址订阅列表: To specify a subscription/unsubscription address, say joe@example.com, send the message to:
- listname-subscribe-joe=example.com@list.cr.yp.to.
1.11.1.1. qmail
这是一个主要的qmail邮件列表.讨论和提问/回答很多有关于qmail的问题. 不过不包括有关于他们自己的列表的问题. 在这个列表提问之前请阅读Charles Cazabon的"12 Steps to qmail List Bliss" web页面位置 http://www.qcc.sk.ca/~charlesc/writings/12-steps-to-qmail-list-bliss.html .同时请首先阅读FAQ或者在这里搜索列表的过去的文章. 提问的时候, 请尽量包含充分详尽的细节, 便于其他人回答. 请注意以下这些提问要点: The main qmail mailing list. For discussion and questions/answers on most things related to qmail, except those with their own lists. Read Charles Cazabon's "12 Steps to qmail List Bliss" at http://www.qcc.sk.ca/~charlesc/writings/12-steps-to-qmail-list-bliss.html before posting. Also read the FAQs and search the list archives before posting a question. When you ask questions, please try to include sufficient details to make it possible for people to respond:
- 你做了什么? 你的配置? 如果你不清楚哪些比较重要, 那就把qmail-showctl 的输出算上. 你都做了那些举动? 如果是新安装的qmail, 讲述一下你如何安装的. What did you do? What's your configuration? Include qmail-showctl output if you're not sure what's important. What action did you take? If this is a new installation, tell how you installed qmail.
- 你期待发生什么? 你想达到一个什么目的? 不要假设读者会猜到你的想法. What did you expect to happen? What was the outcome you were trying to achieve? Don't assume the reader can guess.
- 曾经发生了什么? 描述一下实际的结果. 包括log文件的部分剪辑, 消息的副本, 包括头部分. What did happen? Describe the actual result. Include log file clippings and copies of messages, with headers.
注意: qmail的邮件列表使用了一个叫做qsecretary的工具来校验投递到列表的邮件是否是垃圾邮件. 每封到达列表的邮件都会首先由qsecretary返回一个确认邮件. 用户阅读确认邮件并且按照返回邮件上的指令确认你的邮件--通常就是回复qsecretary的确认信息就可以了. 经常在列表投递的订户一般使用类似Charles Cazabon的pymsgauth (http://www.qcc.ca/~charlesc/software/pymsgauth/pymsgauth.html.) 的自动回复程序来自动完成邮件确认. pymsgauth 校验发往列表的邮件的确是你发出的, 所以它不会确认那些冒充你的名字发送到列表的邮件. Note: The qmail list uses a utility called qsecretary to verify that messages posted to the list are not spam. Each message posted to the list will result in an e-mail confirmation request from qsecretary. Read the message and follow the directions to confirm your message--usually just replying to the qsecretary message will do the trick. Regular list posters often automate this process using autoresponders like Charles Cazabon's pymsgauth, available from http://www.qcc.ca/~charlesc/software/pymsgauth/pymsgauth.html. pymsgauth verifies that message sent to the qmail list really came from you, so it won't automatically confirm forged messages sent to the list in your name.
1.11.1.2. qmailannounce
qmail的公告邮件列表. 没有投稿地址, 这是个只读的列表. The qmail announcement mailing list. New releases are announced here. There's no submission address: it's a read-only list.
1.11.1.3. serialmail
讨论serialmail 软件的列表. For discussion of the serialmail package.
1.11.1.4. ezmlm
ezmlm 邮件列表管理器的的讨论列表. For discussion of the ezmlm mailing list manager.
1.11.2. 咨询者 Consultants
参看 http://www.qmail.org/top.html#paidsup 的商业支持提供者名单. See http://www.qmail.org/top.html#paidsup for a list of commercial support providers.
1.11.3. FAQTS 知识库 FAQTS Knowledgebase
http://qmail.faqts.com/ 一个qmail相关问题的数据库, 包括问题解答.如果你在FAQ里面找不到回答, 试试搜索这个知识库. 它的专长在于回答"如何去作"的问题. A database of qmail-related questions and answers is available at http://qmail.faqts.com/. If you have a question that the FAQ doesn't answer, try searching this knowledgebase. It's especially good at answering "how to" questions.
2. 安装 Installation
这一节介绍qmail的安装. 如果你是个经验丰富的系统管理员, 你完全可以按照qmail的发布源文件里面的INSTALL文件的指导完成安装. INSTALL文件并不是正式的安装指导. 哪个指导比 Life with qmail, 也就是本文的指导复杂很多. INSTALL文件假定读者是一个经验丰富的系统管理员或者邮件管理员. 而且那个文件也比较陈旧, 反映不了Bernstein(qmail作者)最近的操作规程建议. This section covers installing qmail. If you're an experienced system administrator, you can install qmail following the directions in INSTALL in the source distribution. The INSTALL directions are the official installation directions. They're more complex than the Life with qmail directions, and they assume that the reader is an experienced system and mail administrator. They're also outdated and don't reflect Bernstein's current recommended practices.
注意: 如果你选择使用下面的安装指导, 请你一定要通读下面整个小节以熟悉全部安装过程. Note: If you choose to install using the following directions, you should read through the entire section to familiarize yourself with the overall process.
2.1. 不同的安装发布形式以及相互的比较 Installation Issues
2.1.1. 二进制安装对比源代码安装 Binary vs. source code
由于qmail关于预先编译包的限制性的许可, 通常qmail都是由源代码安装的. Due to qmail's restrictive licensing regarding the distribution of prebuilt packages, qmail is usually installed from a source code distribution.
如果你不是很熟悉源代码和二进制的区别, 想像一下你订了一个pizza饼. "二进制"形式的pizza饼送来了立刻就能吃, 而"源代码"pizza饼就像全部制作pizza的材料, 面粉, 发酵粉, 干酪, 沙司还有浇头调料, 以及烹饪pizza的指导, 你必须自己作pizza. 虽然有点费劲, 不过如果你仔细的按照指导来作, 结果是一样的, 甚至更好. 自己作的pizza更新鲜, 你也可以按照自己的配置调整浇头调料, 并且你更多的了解了你的pizza以及它是如何"工作"的. If you're not familiar with the distinction between source code and binaries, imagine ordering a pizza delivered to your house. The "binary" version of the pizza arrives ready-to-eat. The "source code" pizza comes as a kit containing flour, yeast, cheese, sauce, toppings, and directions for cooking the pizza yourself. Source code installations are a little more work for you, but if you follow the directions carefully, the result is the same--or even better. The self-baked pizza will be fresher, you can adjust the toppings to your preferences, and you'll know a lot more about your pizza and how it "works".
安全的运行一个因特网服务并不容易. 一个不适当配置的服务可能给你的主机系统带来被攻击以及被用来攻击其他站点的风险--有可能让管理员承担法律责任的安全风险. 更多的知道你的网络服务如何运行的, 就更有可能让他们正确和安全的工作. Safely running an Internet-accesible network service is not easy. An improperly configured service can put the host system at risk of attack or can be used to attack other sites--potentially exposing the administrator to legal liability. The more you know about how your network services work, the more likely they are to be properly configured and secure.
2.1.2. Tarball 对比 特定操作系统安装包 (Tarball vs. OS-specific package) Tarball vs. OS-specific package
一些操作系统提供一种自动源代码安装机制. 回到上文我们的pizza制作分析里面. 这就好像把所有的pizza的成分和制作指导都打包到一起, 这样你简单的按一下按钮pizza就能把自己烤好啦. Some operating systems provide a mechanism for automating source code installations. Returning to the pizza analogy, they make it possible to package the ingredients and directions in such a way that you can just push a button and have the pizza bake itself.
听起来很不错, 是吧? Sounds great, doesn't it?
实际上, 哪不是一个想当然的好主意. 组装这些包是个相当困难的工作, 它们有时并不是按照假定的方式工作的. 这是软件, 而且和其他软件一样, 他们会有bugs. 即使不提那些bugs, 那些安装的方便也是用牺牲你自己烤的pizza饼的很多优点来达到的. 比如你自己调整浇头调料的的能力, 还有知道怎么作pizza饼, 以及pizza如何工作等等. In practice, it might not be such a good idea. Assembling these packages is pretty difficult, and they might not do things the way they're supposed to. They're software, and like any software, they can have bugs. But even if they're bug free, the convenience they provide comes at a cost. You lose most of the advantages of the self-baked pizza: the ability to adjust the toppings to your personal preferences, and the knowledge of how the pizza was made and how it works.
如果qmail仅仅是一个pizza, 哪自安装方式还是可以接受的. 不过qmail可是个相当复杂的系统. 安装和维护qmail的人都需要对它相当的了解才能平稳的运行它. 自安装方式的qmail更容易安装, 不过用户手动安装方式更容易调整配置和查找故障. 你可能就安装一次qmail, 但是你可能要几次才能调整好它, 或者当邮件并不是按照你想要的方式运行的时候, 设法找出并解决问题. If qmail was a pizza, the self-building approach might still be the way to go. But it's not: it's a fairly complicated system that the installer/maintainer needs to understand pretty well in order to be able to keep it working smoothly. The self-installing qmail is easier to install than the user-installed version, but the user-installed version is easier to configure and troubleshoot. You install qmail once on a system, but you will probably have several opportunities to reconfigure it or try to figure out why mail isn't flowing the way you think it should.
由于这些原因, 我建议使用源代码的tarball方式安装, 而不是Red Hat RPM或者其他自安装包方式. For this reason, I suggest installing qmail from scratch using the source code tarball, not a Red Hat RPM or other self-installing bundle.
2.2. 准备工作 Preparation
安装qmail之前, 尤其如果是你第一次安装qmail, 有几个需要注意的地方. Before installing qmail on a system, especially if this is your first qmail installation, there are a few things you need to think about.
- 如果可能, 尽量在一个"试验"系统上安装qmail. 这样的话可以有机会犯错, 不至于在正在工作的服务器上安装时丢失重要的邮件或者中断mail服务. If possible, install qmail on a "practice" system. This will give you a chance to make mistakes without losing important mail or interrupting mail service to your users.
- 如果你没有空闲的计算机系统, 而你要安装的系统上面已经运行sendamil, smail或者其他的MTA投递邮件的时候, 你可以安装大部分的qmail而不中断现有的邮件服务. If you don't have a spare, and your system is already handling mail using sendmail, smail, or some other MTA, you can install and test most pieces of qmail without interfering with the existing service.
- 如果从其他MTA移植到qmail--即使你在qmail上已经很有经验--首先制订一个计划, 也是非常必要的. When migrating a system from some other MTA to qmail--even if you've got some qmail experience under your belt--it's a good idea to formulate a plan.
2.3. 系统要求 System requirements
qmail 必须安装在UNIX或者类UNIX系统上, 一些系统要求: qmail will install and run on most UNIX and UNIX-like systems, but there are few requirements:
- 安装需要大约10兆空间. 安装之后可以删除目标文件释放出大约4兆空间. About 10 megabytes of free space in the build area during the build. After the build, you can free all but 4 megabytes by removing the object files.
- 一个完整的C开发环境, 包括编译器, 系统头文件, 以及函数库. 构建指导将告诉你如何显示你是否拥有这些必要的部分. A complete, functioning C development system including a compiler, system header files, and libraries. The build directions will show you how to tell if you've got the necessary parts.
- 二进制代码, 文档, 和配置文件需要几兆空间. A few megabytes for the binaries, documentation, and configuration files.
- 队列需要一个安全的文件系统. qmail 的可靠性要求文件系统兼容传统的BSD FFS语义. 大多数现代的本地文件系统都符合这个要求除了一个很重要的例外: link()系统调用常常是异步的--这意味着link()操作返回时不会将数据写入磁盘. Bruce Guenter 的syncdir 库可以用来解决这个问题. 更多信息请参见附录里面相关软件包 syncdir. A safe filesystem for the queue. qmail's reliability guarantee requires that the queue reside on a filesystem with traditional BSD FFS semantics. Most modern local filesystems meet these requirements with one important exception: the link() system call is often asynchronous--meaning that the results of the link() operation might not have been written to disk when the link() call returns. Bruce Guenter's syncdir library can be used to work around this problem. See syncdir in the Related Packages appendix for more information.
- 队列需要的足够的磁盘空间. 小型单用户系统仅仅需要2兆. 大型系统可能需要2吉(2G). Sufficient disk space for the queue. Small single-user systems only need a couple megabytes. Large servers may need a couple gigabytes.
- 兼容的操作系统. 多数变种UNIX都可以. 参考qmail源代码里面的README文件, 里面有已知的兼容系统版本列表. A compatible operating system. Most flavors of UNIX are acceptable. See README in the source tree for a list of known compatible releases.
- 最好有权使用域名服务器. 没有这个条件, qmail就只能按照smtproutes配置文件里面配置的远程主机发送邮件. Access to a domain name server (DNS) is highly recommended. Without one, qmail can only send to remote systems configured in its smtproutes config file.
- 足够的网络带宽. qmail是为良好接入网络的系统设计的, 所以你不可能在一个28.8k的拨号线路上运行一个邮件列表. serialmail软件包是为在低速连接上的系统运行qmail而设计的. 更多信息请参见附录内serialmail相关的节. Adequate network connectivity. qmail was designed for well-connected systems, so you probably don't want to try to use it for a mailing list server on a 28.8k dial-up. The serialmail package was designed to make qmail more compatible with poorly-connected systems. See the serialmail section in the Related Packages appendix for more information.
2.4. 下载源代码 Download the source
好, 你已经准备好安装qmail的系统了. 第一步就是下载qmail和插件的源代码. 当然了, 你需要qmail, 还有ucspi-tcp和daemontools. OK, so you've got a system meeting the requirements ready for installing qmail. The first step is to download the source code for qmail and any other add-ons. You'll need qmail, of course, and you should probably also get ucspi-tcp and daemontools:
- qmail, ftp://cr.yp.to/software/qmail-1.03.tar.gz
- ucspi-tcp, ftp://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
- daemontools, ftp://cr.yp.to/daemontools/daemontools-0.76.tar.gz
用你的web浏览器, 或者web客户端(比如wget), FTP客户端下载这些源代码. Retrieve these files using your web browser, web client (e.g., wget), or FTP client.
注意: 如果这些链接的其中任何一个失效, 都有可能由于他们已经升级了, 如果是这种情况, 你需要到http://cr.yp.to/software.html 查找相应软件包的链接下载最新版本. 有可能升级版本不兼容下面的指导内容, 所以请一定阅读这些发行版本的"Upgrading from previous version..."小节中的注意事项. Note: If any of the links fail, it's probably because the package has been updated. In that case, you should go to http://cr.yp.to/software.html and follow the links to download the current version. It's possible that upgraded versions aren't compatible with the following instructions, so be sure to read the release notes in the "Upgrading from previous versions..." sections.
2.5. 编译源代码 Build the source
2.5.1. 检验编译(源代码)环境 Verify build environment
首先你要确定的是你有编译程序的必要的工具. 如何确定取决于你使用的UNIX变种. 虽然不能保证可靠, 但最简单的断定方式就是去试. The first thing you need to do is make sure that you have the necessary tools to compile a program. How you determine this depends on what flavor of UNIX you're using. The easiest way to tell, although it's not guaranteed, is to try it.
注意: 下面任何一个测试通过了, 你都可以停下来直接跳到下一节. Note: If any one of these tests passes, you can stop and go on to the next section.
- 在计算机的命令提示行下, 敲入 cc 然后回车. At a command line prompt, type cc and press Enter:
$ cc
cc: No input files specified
$
- 如果你得到类似上面的反应, 表明你的缺省搜索访问路径上有一个可用的C编译器. 如果没有类似反应, 也不意味着你必然没安装任何C编译器.
也有可能那个编译器不在你的缺省搜索访问路径上, 当然, 也有可能你根本没有编译器. 接着来试这几个命令: If you get a similar
response, you have a C compiler in your path. If not, it doesn't necessarily
mean you don't have one installed. You might, but maybe it isn't in your path.
Of course it could also mean that you don't have one. Try these:
- /usr/bin/cc
- /usr/bin/gcc
- /usr/local/bin/cc
- /usr/local/bin/gcc
- /usr/ccs/bin/cc
- 如果他们中间没有一个命令起作用, 你可能要多试点和平台有关的命令啦. 在命令提示符下, 区别于你使用的平台不同, 分别敲入以下命令: If none
of these works, you'll have to try something little more platform specific. At
the prompt try one of these, depending on which OS you're using:
- Red Hat Linux: rpm -qa | grep gcc 或者 rpm -qa | grep egcs
- FreeBSD: 默认安装已经包括了GCC编译器. FreeBSD: includes GCC by default
- 如果你找不到编译器, 你必须找到它的位置或者安装一个. 联络你的操作系统销售商或者操作系统技术支持. If you can't find a compiler installed, you'll have to locate one and install it. Contact your OS vendor or other OS support channel.
这节我们将要实现编译qmail的步骤. 剪切/粘贴(意思是复制或者粘贴脚本和命令行. 译者注) 会很方便, 不过也不是必须的. In this section we'll go through the actual steps of compiling qmail. A way to cut-n-paste will come in handy here, but isn't really necessary.
2.5.2. 解压发行包 Unpack the distribution
如果你一直按照这个指导来作, 那么现在你已经有了一个C编译器, 以及源代码的tarball副本. 下一步, 拷贝或者移动tarball包到工作目录. /usr/local/src对于qmail和ucspi-tcp安装是个不错的选择. daemontools必须建立在/package下. If you made it this far, you have a working C compiler and copies of the tarballs. Next, copy or move the tarballs to the directory you want to do the work in. /usr/local/src is a good choice for qmail and ucspi-tcp. daemontools should be built under /package.
现在你应该成为root用户, 如果你还没有, 那就成为root吧. At this time you probably want to become root, if you're not already.
su
umask 022
mkdir -p /usr/local/src
mv qmail-1.03.tar.gz ucspi-tcp-0.88.tar.gz /usr/local/src
mkdir -p /package
mv daemontools-0.76.tar.gz /package
chmod 1755 /package
现在你可以解开软件包了. Now you can unpack the packages.
cd /usr/local/src
gunzip qmail-1.03.tar.gz
tar xpf qmail-1.03.tar
gunzip ucspi-tcp-0.88.tar.gz
tar xpf ucspi-tcp-0.88.tar
rm *.tar # 可选的, 除非磁盘空间非常紧张. optional, unless space is very tight
cd /package
gunzip daemontools-0.76.tar.gz
tar xpf daemontools-0.76.tar
rm *.tar # 可选的, 同上optional, again
那么, 现在应该有下面几个目录 /usr/local/src/qmail-1.03, /usr/local/src/ucspi-tcp-0.88, 和 /package/admin/daemontools-0.76. There should now be directories called /usr/local/src/qmail-1.03, /usr/local/src/ucspi-tcp-0.88, and /package/admin/daemontools-0.76.
2.5.3. 建立目录 Create directories
qmail安装程序会自行创建需要的子目录, 你只需要创建qmail的"home"目录. Since qmail's installation program creates the subdirectories as they're needed, you only need to create the qmail "home" directory:
mkdir /var/qmail
然后直达下一节. And on to the next section.
注意: 如果你想把qmail的全部或者部分文件安装到除了/var的其他地方, 可以在/var/qmail下建立软链接到其他位置. Note: If you want some or all of the qmail files to reside elsewhere than /var, this can be accomplished by creating symbolic links under /var/qmail pointing to the other locations.
举个例子, qmail配置文件可以存放在/etc/qmail下面, 如下操作: , For example, the qmail configuration files can be stored in /etc/qmail by doing:
mkdir /etc/qmail
ln -s /etc/qmail /var/qmail/control
2.5.4. 创建用户和组 Create users and groups
最容易的创建用户和组的方式是创建一个小脚本文件然后执行它. 在源代码目录下你可以找到一个名字是INSTALL.ids的文件, 它包括了在你的系统平台下创建用户和组的命令行. 复制这个文件并命名另外一个名字, 编辑它来运行命令既快捷又简单. The easiest way to create the necessary users and groups is to create a little script file to do it for you. In the source directory you'll find a file called INSTALL.ids. It contains the command lines for many platforms, so copying the file to another name and editing that is quick and easy.
cd /usr/local/src/qmail-1.03
cp INSTALL.ids IDS
接下来, 用你最顺手的编辑器, 删除文件其余部分, 除了保留你的平台需要的命令部分. 举个例子, 下面是FreeBSD平台编辑之后留下的部分: Then, using your favorite editor, remove all of the file except the lines you want. For example, here's what IDS would look like for FreeBSD after editing:
pw groupadd nofiles
pw useradd alias -g nofiles -d /var/qmail/alias -s /nonexistent
pw useradd qmaild -g nofiles -d /var/qmail -s /nonexistent
pw useradd qmaill -g nofiles -d /var/qmail -s /nonexistent
pw useradd qmailp -g nofiles -d /var/qmail -s /nonexistent
pw groupadd qmail
pw useradd qmailq -g qmail -d /var/qmail -s /nonexistent
pw useradd qmailr -g qmail -d /var/qmail -s /nonexistent
pw useradd qmails -g qmail -d /var/qmail -s /nonexistent
然后运行这个脚本, 用chmod将脚本设置为可执行或者用sh来运行它. Then to run it, either use chmod to make it executable or run it with sh:
第一种方法: First method:
chmod 700 IDS
./IDS
第二种方法: Second method:
/bin/sh IDS
这个脚本运行完毕, 你的所有的用户和组就已经添加完毕, 你可以继续下一节的安装了. When the script finishes, all of your users and groups will be created and you can go on to the next section.
可是如果你的系统不在INSTALL.ids上怎么办? 那你就必须手动创建用户和组了. 使用你比较顺手的编辑器编辑/etc/group, 增加下面两行: But what do you do if your system isn't listed in INSTALL.ids? You'll have to create them manually. Start by using your favorite editor and editing /etc/group. You need to add the following two lines to the end of the file:
qmail:*:2107:
nofiles:*:2108:
注意: 首先确定2107和2108没有被使用, 如果已经被占用, 选择2个文件中未用的数字. Note: Make sure that 2107 and 2108 aren't already used. If they are used, select two numbers that aren't already in use.
下一步, 使用vipw(大多数系统都有这个命令, 如果没有你就必须用编辑器手动编辑, 不过这次可是/etc/passwd文件)在文件尾部增加下面这些行: Next, using vipw (most systems have it, if not you'll need to use your editor again but this time on /etc/passwd) add these lines to the end of the file:
alias:*:7790:2108::/var/qmail/alias:/bin/true
qmaild:*:7791:2108::/var/qmail:/bin/true
qmaill:*:7792:2108::/var/qmail:/bin/true
qmailp:*:7793:2108::/var/qmail:/bin/true
qmailq:*:7794:2107::/var/qmail:/bin/true
qmailr:*:7795:2107::/var/qmail:/bin/true
qmails:*:7796:2107::/var/qmail:/bin/true
注意: 首先确定7790-7796这些未被占用以及和刚才上面编辑的2107, 2108是同一个组id. 如果任意一个用户ID(UID)被占用, 必须选用其他未被占用的用户id. Note: Make sure 7790-7796 aren't already in use and that 2107 and 2108 are the same group ids you used above. If any of these UID's are already being used, select numbers that aren't already in use.
你不必一定把这些行加到文件尾部, 这样作只是最容易说明的方式. You don't specifically need to add any of these lines to the end of the file, that's just the easiest way to explain it here.
你现在已经可以进入下一节了. You're now ready to continue on to the next section.
2.5.5. 编译 Do the build
现在你可以开始编译qmail了. 进入/usr/local/src/qmail-1.03目录, 我们开始吧! Now you can start building qmail. Change to the /usr/local/src/qmail-1.03 directory and let's get started:
cd /usr/local/src/qmail-1.03
在检验编译环境小节, 你定位了你的C编译器. 如果它的名字不是cc或者不在你访问的环境变量PATH定义的任何目录下, 你必须修改conf-cc和conf-ld. 假设你的编译器名字是gcc, 并且gcc在你的环境变量PATH内可见, 那么简单来说, 编辑conf-cc和conf-ld然后置换所有"cc"为"gcc"就可以了. In the Verify Build Environment section, you located your C compiler. If it's not called cc or the directory it resides in isn't in your PATH environment variable, you'll need to edit conf-cc and conf-ld. Say your compiler is gcc, and it's in your PATH. Simply edit conf-cc and conf-ld and replace "cc" with "gcc".
现在敲入下面的命令: Now type the following:
make setup check
这个编译完成之后, 你需要作一些安装后配置工作. 运用下面两个脚本用来让工作更简单. After the build is complete, you'll need to do your post installation configuration. A couple of scripts are provided to make this job a lot easier.
如果你的DNS配置恰当, 这个脚本就是你要的. If your DNS is configured properly, this script should be all you need at this point:
./config
如果由于某些原因config不能在DNS找到你的主机名, 你就必须运行config-fast脚本: If, for some reason, config can't find your hostname in DNS, you'll have to run the config-fast script:
./config-fast the.full.hostname
举个例子, 如果你的域名是example.com, 你的计算机的主机名是dlphin, 你的config-fast行应该这样写: For example, if your domain is example.com and the hostname of your computer is dolphin, your config-fast line would look like this:
./config-fast dolphin.example.com
注意: 你可能计划在小型本地局域网使用假域名比如"local", 举例来说, 如果你的主机名是"mash", 你可能要用 ./config-fast mash.local , 如果你这样作了, 要确定配置qmail在返回地址上使用了合法的因特网域名. (参见第3节, 配置.) Note: On a small local LAN you might want to use a pseudo domain such as ".local". E.g., if your hostname is "mash", you could do ./config-fast mash.local. If you do this, be sure to configure qmail to use a valid Internet domain name in return addresses. (See section 3, Configuration.)
qmail现在已经安装到你的系统内, 并且准备运行了! 下一节将要介绍运行和测试qmail. qmail is now installed on your system and is ready to be run! The next section will guide you through the steps of starting and testing qmail.
2.6. 安装 ucspi-tcp Install ucspi-tcp
刚才你解压了qmail, ucspi-tcp, 和daemontools 的tarball包, 现在进入ucspi-tcp目录. , Earlier, you unpacked the qmail, ucspi-tcp, and daemontools tarballs. Now change to the ucspi-tcp directory:
cd /usr/local/src/ucspi-tcp-0.88
刚才在编译一节, 如果你修改了conf-cc和conf-ld文件, 你必须在这个目录作同样的修改. In the Do the build section, if you modified conf-cc and conf-ld, you'll need to make the same changes in this directory.
然后, 运行: Then do:
make
make setup check
ucspi-tcp安装完毕. That's it. ucspi-tcp is installed.
2.7. 安装 daemontools Install daemontools
进入daemontools安装目录 Change to the daemontools build directory:
cd /package/admin/daemontools-0.76
再说一次, 如果你在编译qmail和ucspi-tcp的时候修改了conf-cc和conf-ld文件, 你必须在在src目录作同样的修改. Once again, if you modified conf-cc and conf-ld during the qmail and ucspi-tcp builds, you'll need to make the same changes in the src directory.
然后, 运行: Then do:
package/install
在BSD系统(没有 /etc/inittab), 你必须重新启动计算机再运行svscan, 这是后台服务器的管理服务程序. 上On BSD systems (no /etc/inittab), you'll need to reboot at this point to start svscan, the master service control daemon.
使用 "ps -ef | grep svscan" 或者"ps waux | grep svscan"检查svscan是否在运行. Use "ps -ef | grep svscan" or "ps waux | grep svscan" to verify that svscan is running.
注意: 在Solaris下, 你必须修改/etc/inittab中关于svscan的启动条目, 将 Note: Under Solaris, you'll have to modify the /etc/inittab entry that starts svscan from:
SV:123456:respawn:/command/svscanboot
改为: to:
SV:123456:respawn:/command/svscanboot </dev/null >/var/log/svscan 2>&1
或者改为: or:
SV:123456:respawn:/command/svscanboot </dev/null >/dev/msglog 2>&1
这取决于你是想把启动svscan的出错消息记录到log文件里面还是显示到控制台上. 这样作的必要性请参考下面的文章: Depending upon whether you want error messages resutling from starting svscan to be sent to a log file or the system console. For an explanation of why this is necessary, see:
http://marc.theaimsgroup.com/?l=log&m=100327801309834&w=2
注意: 一个Slackware的用户报告x1之前的SV /etc/inittab条目必须被移动, 否则启动后无法运行svscan. Note: A Slackware user reports that the SV /etc/inittab entry has to be moved before the x1 entry or svscan won't be started at boot-up.
2.8. 运行 qmail Start qmail
2.8.1. /var/qmail/rc
/var/qmail/boot 目录包含了不同配置的qmail启动脚本示例: /var/spool/mail 方式和$HOME/Mailbox 方式, 使用procmail或者.forward 控制文件, 以及这些方式的不同组合配置. 你可以随意考查这些方式, 不过这里我们选用下面的脚本: The /var/qmail/boot directory contains example qmail boot scripts for different configurations: /var/spool/mail vs. $HOME/Mailbox, using procmail or dot-forward, and various combinations of these. Feel free to examine these, but for our installation, we'll use the following script:
#!/bin/sh
# Using stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by default
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start "`cat /var/qmail/control/defaultdelivery`"
注意: 这个脚本使用了反引号(`), 而不是单引号('). 最好拷贝和粘贴上文的脚本而不是自己敲一遍, 后者容易出错. Note: This script uses backquotes (`), not single quotes ('). For best results, copy and paste the scripts in this guide instead of retyping them.
用你的编辑器将上面的脚本保存为 /var/qmail/rc, 然后执行下面这些命令: Use your editor to create the above /var/qmail/rc, then execute these commands:
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
现在你需要决定一下不是由.qmail 文件传送的邮件的默认传输方式, 下面的列表大致阐述了几种一般性的选择: At this point you need to decide the default delivery mode for messages that aren't delivered by a .qmail file. The following table outlines some common choices.
| 邮箱格式 Mailbox format | 名称 Name | 保存位置Location | 缺省的传输方式defaultdelivery | 注释 Comments |
| mbox | Mailbox | $HOME | ./Mailbox | 最常见的格式, 大多数MUA都可以正确识别 most common, works with most MUA's |
| maildir | Maildir | $HOME | ./Maildir/ | 更可靠, MUA支持较少 more reliable, less MUA support |
| mbox | username | /var/spool/mail | 参见 INSTALL.vsm文件 See INSTALL.vsm | 传统的UNIX邮箱 traditional UNIX mailbox |
更多信息请参考 INSTALL.mbox, INSTALL.maildir 和 INSTALL.vsm 文件. See INSTALL.mbox, INSTALL.maildir, and INSTALL.vsm for more information.
选择缺省的邮箱格式, 只要选择上表里面的"缺省传输方式"的值, 填写到/var/qmail/control/defaultdelivery里面就可以了. 例如, 选择标准的qmail /Mailbox 传送格式, 这样作就行了: To select your default mailbox type, just enter the defaultdelivery value from the table into /var/qmail/control/defaultdelivery. E.g., to select the standard qmail Mailbox delivery, do:
echo ./Mailbox >/var/qmail/control/defaultdelivery
注意: defaultdelivery并不是标准的qmail控制文件. 而是上文/var/qmail/rc 文件的要素. 对于qmail-start来说, defaultdelivery 变量 只是在没有实际的 .qmail 文件指定传送指令的情况下作为 .qmail 文件的内容出现的. 加上这个指令就不必再引用shell元字符, 避免了出现多行杂乱的命令参数. Note: defaultdelivery isn't a standard qmail control file. It's a feature of the above /var/qmail/rc file. The defaultdelivery argument to qmail-start is the contents of a .qmail file that specifies delivery instructions to be followed when no actual .qmail is found. Putting these instructions in a separate control file eliminates the need to quote shell metacharacters in the delivery instructions and avoids messy multi-line command arguments.
2.8.2. 系统启动文件 System start-up files
2.8.2.1. qmailctl 脚本 The qmailctl script
如果你手动执行/varqmail/rc 脚本, qmail只会部分被运行起来. 可是我们希望希望每次系统启动后, qmail都能自动被启动; 每次系统停止时候qmail自动被关闭. If you were to manually execute the /var/qmail/rc script, qmail would be partially started. But we want qmail started up automatically every time the system is booted and we want it shut down cleanly when the system is halted.
创建一个如下的 /var/qmail/bin/qmailctl 文件可以完成这个愿望: This is accomplished by creating a startup/shutdown script like the following in /var/qmail/bin/qmailctl:
#!/bin/sh
# For Red Hat chkconfig
# chkconfig: - 80 30
# description: the qmail MTA
PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
case "$1" in
start)
echo "Starting qmail"
if svok /service/qmail-send ; then
svc -u /service/qmail-send /service/qmail-send/log
else
echo "qmail-send supervise not running"
fi
if svok /service/qmail-smtpd ; then
svc -u /service/qmail-smtpd /service/qmail-smtpd/log
else
echo "qmail-smtpd supervise not running"
fi
if [ -d /var/lock/subsys ]; then
touch /var/lock/subsys/qmail
fi
;;
stop)
echo "Stopping qmail..."
echo " qmail-smtpd"
svc -d /service/qmail-smtpd /service/qmail-smtpd/log
echo " qmail-send"
svc -d /service/qmail-send /service/qmail-send/log
if [ -f /var/lock/subsys/qmail ]; then
rm /var/lock/subsys/qmail
fi
;;
stat)
svstat /service/qmail-send
svstat /service/qmail-send/log
svstat /service/qmail-smtpd
svstat /service/qmail-smtpd/log
qmail-qstat
;;
doqueue|alrm|flush)
echo "Flushing timeout table and sending ALRM signal to qmail-send."
/var/qmail/bin/qmail-tcpok
svc -a /service/qmail-send
;;
queue)
qmail-qstat
qmail-qread
;;
reload|hup)
echo "Sending HUP signal to qmail-send."
svc -h /service/qmail-send
;;
pause)
echo "Pausing qmail-send"
svc -p /service/qmail-send
echo "Pausing qmail-smtpd"
svc -p /service/qmail-smtpd
;;
cont)
echo "Continuing qmail-send"
svc -c /service/qmail-send
echo "Continuing qmail-smtpd"
svc -c /service/qmail-smtpd
;;
restart)
echo "Restarting qmail:"
echo "* Stopping qmail-smtpd."
svc -d /service/qmail-smtpd /service/qmail-smtpd/log
echo "* Sending qmail-send SIGTERM and restarting."
svc -t /service/qmail-send /service/qmail-send/log
echo "* Restarting qmail-smtpd."
svc -u /service/qmail-smtpd /service/qmail-smtpd/log
;;
cdb)
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
chmod 644 /etc/tcp.smtp.cdb
echo "Reloaded /etc/tcp.smtp."
;;
help)
cat <<HELP
stop -- stops mail service (smtp connections refused, nothing goes out)
start -- starts mail service (smtp connection accepted, mail can go out)
pause -- temporarily stops mail service (connections accepted, nothing leaves)
cont -- continues paused mail service
stat -- displays status of mail service
cdb -- rebuild the tcpserver cdb file for smtp
restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it
doqueue -- schedules queued messages for immediate delivery
reload -- sends qmail-send HUP, rereading locals and virtualdomains
queue -- shows status of queue
alrm -- same as doqueue
flush -- same as doqueue
hup -- same as reload
HELP
;;
*)
echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}"
exit 1
;;
esac
exit 0
这个脚本可以在线下载, 地址是http://www.lifewithqmail.org/qmailctl-script-dt70. This script is available via http://www.lifewithqmail.org/qmailctl-script-dt70.
你可以自己输入这个脚本, 不过我推荐你用浏览器下载上面链接的文件. Create the script using your editor or by downloading it with your web browser (recommended).
将上面这个qmailctl 脚本设置为可执行脚本, 然后链接到你的用户执行程序目录: Make the qmailctl script executable and link it to a directory in your path:
chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin
2.8.2.2. supervise 脚本 The supervise scripts
为 qmail 的服务创建 supervise 目录 Now create the supervise directories for the qmail services:
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
建立 /var/qmail/supervise/qmail-send/run 文件 Create the /var/qmail/supervise/qmail-send/run file:
#!/bin/sh
exec /var/qmail/rc
建立 /var/qmail/supervise/qmail-send/log/run 文件: Create the /var/qmail/supervise/qmail-send/log/run file:
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
建立 /var/qmail/supervise/qmail-smtpd/run 文件: Create the /var/qmail/supervise/qmail-smtpd/run file:
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 2000000 \
/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
注意: concurrencyincoming并不是标准的qmail控制文件. 它是上面脚本的一个要素. 并且, 第一个LOCAL 行上面的是"破折号 + 数字1", 下面的tcpserver行上的参数是"破折号 + 小写字母l" . (由于英文小写字母l和数字1容易混淆, 原作者特意补充的注意事项. 由译者将被提到两行修改成为红色. 这也是为什么作者希望读者直接拷贝脚本而不是自行输入避免脚本出错的主要原因之一. 译者注) Note: concurrencyincoming isn't a standard qmail control file. It's a feature of the above script. Also, that's -1 (dash one) on the LOCAL line and -l (dash ell) on the tcpserver line.
注意: Solaris系统下一般位置的id程序不能正常工作, 请使用这个位置的 /usr/xpg4/bin/id: Note: Under Solaris, the normal id program won't work right in this script. Instead of id, use /usr/xpg4/bin/id, e.g.:
QMAILDUID=`/usr/xpg4/bin/id -u qmaild`
NOFILESGID=`/usr/xpg4/bin/id -g qmaild`
注意: 根据你的操作系统和硬件平台的不同, 可能需要调整softlimit命令的的内存限制参数. 如果你的系统出现连接25端口失败和无法接收远程系统发送的邮件, 试一下把这个参数调整到3000000到4000000. Note: The memory limit specified in the softlimit command may need to be raised depending upon your operating system and hardware platform. If attempts to connect to port 25 fail or remote systems are unable to send you mail, try raising it to 3000000 or 4000000.
建立concurrencyincoming 控制文件. Create the concurrencyincoming control file:
echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
建立 /var/qmail/supervise/qmail-smtpd/log/run 文件 Create the /var/qmail/supervise/qmail-smtpd/log/run file:
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd
将各个run文件设置为可执行文件: Make the run files executable:
chmod 755 /var/qmail/supervise/qmail-send/run
chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
然后建立log文件目录: Then set up the log directories:
mkdir -p /var/log/qmail/smtpd
chown qmaill /var/log/qmail /var/log/qmail/smtpd
最后, 建立 supervise 目录到 /service 目录的链接: Finally, link the supervise directories into /service:
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
/service 目录是 daemontools 安装时建立的目录. The /service directory is created when daemontools is installed.
注意: 建立这个链接之后 qmail 系统会很快自动被启动起来, 如果你还不想立刻运行qmail, 运行下面这个,命令来停止qmail: Note: The qmail system will start automatically shortly after these links are created. If you don't want it running yet, do:
qmailctl stop
2.8.2.3. SMTP 访问控制 SMTP Access Control
允许本地主机通过SMTP方式发送邮件: Allow the local host to inject mail via SMTP:
echo '127.:allow,RELAYCLIENT=""' >>/etc/tcp.smtp
qmailctl cdb
2.8.3. 停止并且禁用(其他)已经安装的MTA Stop and disable the installed MTA
虽然有可能同时运行qmail和现存的MTA, 比如Sendmail, 不过我建议你除非你知道自己到底在干什么. 否则, 我可不建议你这么干. 其实, 说实话, 如果你正在读我这段话, 你可能也不知道自己在干嘛. :-) Although it's possible to run both qmail and your existing MTA, which is probably Sendmail, simultaneously, I don't recommend it unless you know what you're doing. And, frankly, if you're reading this, you probably don't know what you're doing. :-)
如果现存的MTA是Sendmail, 你应该能利用运行Sendmail的init.d脚本的"stop"参数来停止它的运行. 例如下面命令中的一个可能是有效的: If your existing MTA is Sendmail, you should be able to stop it by running the init.d script with the "stop" argument. E.g., one of these should work:
/etc/init.d/sendmail stop
/sbin/init.d/sendmail stop
/etc/rc.d/init.d/sendmail stop
如果你找不到任何一个init.d/sendmail 下的脚本, 你可以用 "ps -ef|grep sendmail" 或者 "ps waux|grep sendmail" 命令找出 sendmail 的PID, 然后用下面的命令来停止Sendmail: (kill 命令加上Sendmail的PID作参数, 译者注) If you can't find an init.d/sendmail script, you can locate sendmail's PID using "ps -ef|grep sendmail" or "ps waux|grep sendmail" and stop it using:
kill PID-of-sendmail
如果你的MTA不是Sendmail, 检查相关文档找出正确的停止MTA的方法. If your MTA isn't Sendmail, check its documentation for the correct shutdown procedure.
你应该考虑一下把旧的MTA彻底的从你的系统里面删除. 至少禁用它的 init.d 脚本, 防止下一次系统重启动的时候旧的MTA也被试图重启. You should also consider removing the old MTA completely from the system. At least disable the init.d script so it doesn't try to start up again when the system is rebooted.
对于使用rpm方式安装Sendmail的 Red Hat Linux, 执行下面的命令来删除Sendmail: For Red Hat Linux, removing Sendmail can be accomplished by:
rpm -e --nodeps sendmail
注意: 如果你使用基于RPM方式的Linux, 比如 Red Hat, 删除MTA可能带来进一步的问题. 系统的很多应用程序将会试图重新安装Sendmail, 一些MUA程序将无法安装, 因为他们找不到安装好的MTA. Mate Wierdl 提供了一个占位程序, 称作 "fake_mta", 安装这个程序之后可以防止出现以上的问题. 简单的RPM安装包可以在下面的地址取得 http://www.csi.hu/mw/fake_mta-1-1memphis.noarch.rpm. Note: If you're using an RPM-based Linux distribution like Red Hat, removing the MTA package might cause problems down the road. Utilities that update the system might try to reinstall Sendmail, or MUA packages might not install because they can't tell an MTA is installed. Mate Wierdl provides a stub package called "fake_mta" that can be installed to prevent these problems. Simply install the RPM available from http://www.csi.hu/mw/fake_mta-1-1memphis.noarch.rpm.
检查一下没有其他程序在监听SMTP服务端口(25). 旧的MTA, inetd, 或者 xinetd 等程序都有可能造成问题. (按照以上步骤执行后, 再) 运行下面的命令应该是没有输出结果的(除非这个时候 qmail-smtpd 服务也在运行). Verify that nothing is listening to the SMTP port (25). Culprits could be the old MTA, inetd, or xinetd. The following command should produce no output (unless the qmail-smtpd service is running):
netstat -a | grep smtp
如果有什么程序在运行, 首先确定不是qmail, 那么先运行下面的命令: If something is running, make sure it's not qmail by doing:
qmailctl stop
然后重复 netstat 检查: The repeat the netstat check:
netstat -a | grep smtp
如果你还是能看到这个命令有一些输出, 你就必须在qmail 的SMTP服务运行起来之前把肇事程序找出来. If you still get output from that command you'll have to locate the culprit and fix it before qmail's SMTP service will run.
最后, 将现存的 /usr/lib/sendmail 替代为 qmail 版本. Lastly, replace any existing /usr/lib/sendmail with the qmail version:
mv /usr/lib/sendmail /usr/lib/sendmail.old # 忽略错误提示 ignore errors
mv /usr/sbin/sendmail /usr/sbin/sendmail.old # 忽略错误提示 ignore errors
chmod 0 /usr/lib/sendmail.old /usr/sbin/sendmail.old # 忽略错误提示 ignore errors
ln -s /var/qmail/bin/sendmail /usr/lib
ln -s /var/qmail/bin/sendmail /usr/sbin
注意: 创建 sendmail 的链接是很重要的, 即使不管以前的MTA, sendmail 命令也是一个会被很多程序调用来发送邮件的重要命令. Note: It's important to create the sendmail links, regardless of the previous MTA, if any. The sendmail command is invoked by many applications for sending mail.
最后步骤是建立两个系统别名. The last step is to create a couple of system aliases.
2.8.4. 建立系统别名 Create System Aliases
在所有 qmail 安装上面都要建立三个系统别名: There are three system aliases that should be created on all qmail installations:
| 别名 Alias | 使用目的 Purpose |
| postmaster | RFC 2821 标准要求, 指向邮件系统管理员(也就是你) RFC 2821 required, points to the mail adminstrator (you) |
| mailer-daemon | 反弹邮件事实上的标准接收者 de facto standard recipient for some bounces |
| root | 转发根(root)用户的邮件给系统管理者 redirects mail from privileged account to the system administrator |
建立这些系统别名, 取决于你想让这些邮件发送到哪里(一个本地用户或者一个远程地址)并且适当的创建一个.qmail 文件集合. 举个例子, 加入你想让本地用户 dave 接收发给系统管理员和邮件管理员的邮件, 就这么作: To create these aliases, decide where you want each of them to go (a local user or a remote address) and create and populate the appropriate .qmail files. For example, say local user dave is both the system and mail administrator:
echo dave > /var/qmail/alias/.qmail-root
echo dave > /var/qmail/alias/.qmail-postmaster
ln -s .qmail-postmaster /var/qmail/alias/.qmail-mailer-daemon
chmod 644 /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-postmaster
在 INSTALL.alias 文件里面有更详细的细节. See INSTALL.alias for more details.
2.8.5. 运行 qmail Start qmail
如果依照上文, 你创建 /service 之后就停止了qmail, 你现在应该重新启动 qmail: If you stopped qmail above after creating the links in /service, you should restart it now:
qmailctl start
2.9. 测试安装 Test the Installation
qmail 现在应该是正在运行的状态. 首先运行 qmailctl stat 来检验那些服务启动并运行中: qmail should now be running. First run qmailctl stat to verify that the services are up and running:
# qmailctl stat
/service/qmail-send: up (pid 30303) 187 seconds
/service/qmail-send/log: up (pid 30304) 187 seconds
/service/qmail-smtpd: up (pid 30305) 187 seconds
/service/qmail-smtpd/log: up (pid 30308) 187 seconds
messages in queue: 0
messages in queue but not yet preprocessed: 0
所有的四个服务都应该是"up"(启动了)1秒钟以上. 如果不是这样, 你可能就是在写脚本的时候写错了一些东西或者你漏过了创建一个甚至多个必要的文件, 目录或者链接. 返回上面的安装指导, 一步一步的再检查一下你的工作. All four services should be "up" for more than a second. If they're not, you've probably got a typo in the associated run script or you skipped one or more steps in creating the necessary files, directories, or links. Go back through the installation step-by-step and double check your work.
有时候为了检验配置错误, 手动运行一下服务也会很有帮助的. 举个例子, 如果你的 qmail-smtpd/log 服务正在运行, 那么执行下面的命令: It sometimes helps to run a service manually in order to find configuration problems. For example, if your qmail-smtpd/log service isn't running, do:
cd /service/qmail-smtpd/log
svc -d .
./run
if no errors, enter a line of text and press ENTER
if still no errors, enter CTRL-D (end of file)
这个时候, 你应该能够识别问题所在并且解决它了. 这个做完之后, 返回服务目录, 如果有必要, 运行命令: At this point, you should be able to identify the problem and fix it. Once that's done, return to the service's directory, if necessary, and do:
svc -u .
一旦那些服务的启动时间都大于1秒钟后, 依照 TEST.deliver 和 TEST.receive 文件里面的指令去校验服务是否正确的工作. 注意, 应用这些指令, 由 multilog 运行的日志记录会被写到 /var/log/qmail 下, 而不是 splogger 记录到类似 /var/log/maillog 的文件里面. Once the services are all up with >1 second uptime, follow the instructions in TEST.deliver and TEST.receive to verify that they're working correctly. Note that using these instructions, logging will be accomplished by multilog to /var/log/qmail, not splogger to something like /var/log/maillog.
注意: 如果你悬在了 maildir 邮箱格式作为默认的传送方式, 在运行这些指令之前, 你必须在你的主目录和别名的主目录创建 Maildir 目录. 参见 maildir 小节查找如何恰当的创建这个目录. Note: If you chose maildir mailbox format as the default delivery method, you will need to create a Maildir directory in your home directory and alias's home directory before trying these instructions. See the maildir section to see how to properly create this directory.
3. 配置 Configuration
你已经从源代码tarball方式, 或者自编译包方式, 或者var-qmail包方式安装了 qmail. 这一节的内容就是按照你的需要配置qmail. You've got qmail installed, from the recommended source tarball method, one of the self-compiling packages, or a var-qmail package. This section contains information you will need to configure qmail to make it work the way you want it to.
3.1. 配置文件 Configuration Files
所有的qmail系统配置文件, 包括在~alias下的 .qmail 文件, 位于 /var/qmail/control 目录下. qmail-control 的man手册页包括了一个像下面这样的表: All of qmail's system configuration files, with the exception of the .qmail files in ~alias, reside in /var/qmail/control. The qmail-control man page contains a table like the following:
| 控制文件 Control | 默认值 Default | 被用于 Used by | 使用目的 Purpose |
| badmailfrom | none | qmail-smtpd | From 地址黑名单 blacklisted From addresses |
| bouncefrom | MAILER-DAEMON | qmail-send | 反弹的发送者用户名 username of bounce sender |
| bouncehost | me | qmail-send | 反弹的发送者主机名 hostname of bounce sender |
| concurrencyincoming | none | /service/qmail-smtpd/run | 最大并行 SMTP 连接数 max simultaneous incoming SMTP connections |
| concurrencylocal | 10 | qmail-send | 最大并行本地传送数 max simultaneous local deliveries |
| concurrencyremote | 20 | qmail-send | 最大并行远程传送数 max simultaneous remote deliveries |
| defaultdelivery | none | /var/qmail/rc | 默认的 .qmail 文件 default .qmail file |
| defaultdomain | me | qmail-inject | 默认的域名 default domain name |
| defaulthost | me | qmail-inject | 默认的主机名 default host name |
| databytes | 0 | qmail-smtpd | 邮件最大字节数 (0 等于无限) max number of bytes in message (0=no limit) |
| doublebouncehost | me | qmail-send | 主机名和双重反弹的发送者 host name of double bounce sender |
| doublebounceto | postmaster | qmail-send | 接收双重反弹邮件的用户 user to receive double bounces |
| envnoathost | me | qmail-send | 对缺少"@"符号的地址配置的缺省域名 default domain for addresses without "@" |
| helohost | me | qmail-remote | 在SMTP HELLO命令里面使用的主机名 host name used in SMTP HELO command |
| idhost | me | qmail-inject | 在Message-ID 里面使用的主机名 host name for Message-ID's |
| localiphost | me | qmail-smtpd | 取代本地 IP 地址的名字 name substituted for local IP address |
| locals | me | qmail-send | 进行本地传送的域 domains that we deliver locally |
| me | 系统的正式域名 FQDN of system | various | 许多控制文件的默认要求 default for many control files |
| morercpthosts | none | qmail-smtpd | 二级rcphosts(接收主机)数据库 secondary rcpthosts database |
| percenthack | none | qmail-send | 可以使用"%"模式转信的域 domains that can use "%"-style relaying |
| plusdomain | me | qmail-inject | "+"加号拖尾地址的替代域 domain substituted for trailing "+" |
| qmqpservers | none | qmail-qmqpc | QMQP 服务器IP地址 IP addresses of QMQP servers |
| queuelifetime | 604800 | qmail-send | 邮件在队列内可保留秒数 seconds a message can remain in queue |
| rcpthosts | none | qmail-smtpd | 我们的主机接收邮件的域 domains that we accept mail for |
| smtpgreeting | me | qmail-smtpd | SMTP 问候信息 SMTP greeting message |
| smtproutes | none | qmail-remote | 伪装的SMTP路由 artificial SMTP routes |
| timeoutconnect | 60 | qmail-remote | SMTP连接超时秒数 how long, in seconds, to wait for SMTP connection |
| timeoutremote | 1200 | qmail-remote | 远程连接超时秒数 how long, in seconds, to wait for remote server |
| timeoutsmtpd | 1200 | qmail-smtpd | SMTP客户端超时秒数 how long, in seconds, to wait for SMTP client |
| virtualdomains | none | qmail-send | 虚拟域和用户 virtual domains and users |
查找这些特殊控制文件的更多信息, 请参考上面表格 "被用于" 列下的各个模块的 man 手册页. For more information about a particular control file, see the man page for the module listed under "Used by".
3.2. 中继转信 Relaying
3.2.1. 介绍 Introduction
什么是转信? 转信是 MTA 通过SMTP接收到一封既不是发给本地地址也不是从本地发送者发来的邮件之后, MTA转发这个邮件的动作就是转信. What is relaying? It's when an MTA accepts a message via SMTP that doesn't appear to be either for a local address or from a local sender.
在垃圾邮件时代之前, MTA被配置为开放转信是很常见的: 各种各样的服务器接受来自任何人的邮件, 转发给任何人. In the pre-spam days, it was common for MTA's to be configured as open relays: promiscuous servers that would accept mail from anyone, for anyone.
现代的绝大多数 MTA 都被配置为或者完全禁止转信, 或者只允许某些被信任的用户或者系统使用中继转信功能. Most MTA's now are configured to either completely disable relaying, or to only a allow certain trusted users or systems to use them as a relay.
Chris Johnson 写了一个非常好的关于qmail 用户的文档. 我鼓励你去看一看: http://www.palomine.net/qmail/relaying.html. Chris Johnson has written a very nice document on the topic for qmail users. I encourage you to visit http://www.palomine.net/qmail/relaying.html.
3.2.2. 禁止转信 Disabling relaying
如果你是按照 qmail 的正式安装指导安装的话, 那么转信默认情况下已经被关闭了. 这个功能是通过把local和virtualdomains(指本地主机)文件里面列出的有充分资格的域名写入 /var/qmail/control/rcpthosts 文件来完成的. 而且rcpthosts这个文件名的也是来源于SMTP对话中的的RCPT(接收者)命令. 在SMTP对话里面, RCPT是用来确认邮件接收者地址的, 然后, 列出可以出现在RCPT地址里面的有效的主机名. If you follow the official directions for installing qmail, relaying will be turned off by default. This is accomplished by populating the file /var/qmail/control/rcpthosts with the fully-qualified domain names listed in locals and virtualdomains (the local hosts). The name of the control file, rcpthosts, comes from the SMTP RCPT (recipient) command. In an SMTP session, RCPT is used to specify the addresses of the recipients of a message. rcpthosts, then, lists the valid hostnames that can appear in a RCPT address.
3.2.3. 允许有选择的转信 Allowing selective relaying
大多数单用户和小型工作组服务器可以完全禁止转信, 可是如果你维护的是一个分布式的用户社区, 你就必须有一个方式能够允许你的用户, 而且只能是你的用户通过的你的系统转信. 本文是通过使用 tcpserver 来设置RELAYCLIENT 环境变量, 使 qmail-smtpd 重载 rcpthosts 文件完成这个功能的. Most single-user and small workgroup servers can disable relaying completely, but if you have to support a distributed user community, you'll need a way to allow your users, and only your users, to use your system as a relay. This is accomplished by using tcpserver to set the RELAYCLIENT environment variable, which tells qmail-smtpd to override the rcpthosts file.
如果你是按照这个文档的指导安装的话, 有选择的转信已经在默认情况下安装好了. 如果需要给客户端转信权利, 首先在 /etc/tcp.smtp 文件里面增加类似下面的行: If you follow the installation instructions in this document, selective relaying will be enabled by default. To give a client relay access, add an entry to /etc/tcp.smtp like:
IP address of client:allow,RELAYCLIENT=""
(斜体IP address of client代表客户端的IP地址. 译者注) 然后重建SMTP的访问许可数据库: Then rebuild the SMTP access database by doing:
qmailctl cdb
或者运行下面的命令(重建数据库): or:
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
chmod 644 /etc/tcp.smtp*
如果你是按照正式安装指导安装的, Chris Johnson写了另外一个非常好的如何配置qmail允许选择主机转发邮件的文档, 参见: http://www.palomine.net/qmail/selectiverelay.html. If you followed the official installation instructions, Chris Johnson has written another very nice document on how to configure qmail to allow selected hosts to relay. See http://www.palomine.net/qmail/selectiverelay.html.
3.3. 多主机名 Multiple host names
如果你的主机名已知配置了多个名字, 例如, 所有的来自user@host1.example.com 的地址也可以被写成 user@example.com 或者 user@mail.example.com, 那么你就必须告诉 qmail 那个地址是它应该本地传送的地址, 那个地址是它应该接受的远程主机发往的地址. If your system is known by more than one name, e.g., all addresses of the form user@host1.example.com can also be written as user@example.com or user@mail.example.com, then you need to tell qmail this so it'll know which addresses it should deliver locally and which messages it should accept from remote systems.
如果要这样作, 只要把所有的名字加入下面两个控制文件就行了: To do this, just add all of the names to two control files:
- rcpthosts, 这个文件通知 qmail-smtpd 接收这个主机可以接受的地址. 还有rcpthosts, which tells qmail-smtpd to accept mail addressed to these hosts, and
- locals, 这个文件通知 qmail-send 哪些地址是本地传送地址. locals, which tells qmail-send that addresses on these hosts are to be delivered locally.
给 qmail-send 发送一个HUP(挂起)信号来通知它重新读取 locals文件. 如果你使用的是本文的 qmailctl 脚本, 那么运行下面的命令就可以了: Send qmail-send a HUP (hangup) signal to tell it to reread locals. If you have qmailctl, you can do:
qmailctl reload
3.4. 虚拟域 Virtual domains
虚拟域和上节提到的多主机名类似, 不过这里面有一些很重要的不同之处. 首先如果 example.net 是 virtual.example.net 虚拟域的宿主主机, 那么一个发送给 joe@virtual.example.net 的邮件将不会被发送给即使是同一个邮箱的 joe@example.net.这里虚拟域的名字空间是冲突的. Virtual domains are similar to the multiple host names discussed in the previous section, but there are some important differences. First, if example.net hosts the virtual domain virtual.example.com, it's generally not true that messages sent to joe@example.net should end up in the same mailbox as messages sent to joe@virtual.example.com. The namespace for each virtual domain is distinct.
使用 qmail, 虚拟域将在 virtualdomains 文件里面配置, 文件内由型如下面这行的条目构成: With qmail, virtual domains are configured in the virtualdomains file, which consists of one or more entries of the form:
user@domain:prepend
qmail 转换 user@domain 为 prepend-user@domain 并且对待这个结果好像是本地域一样. user@ 这个是可选的, 如果跳过它, 这个条目将匹配所有 @domain 域下面的地址. qmail converts user@domain to prepend-user@domain and treats the result as if domain was local. The user@ part is optional. If it's omitted, the entry matches all @domain addresses.
回到上文的 example 剧情里面, 如果 example.net 邮件管理员希望创建 virtual.example.com 虚拟域, 并且将这个域置于用户 john 的管理之下, virtualdomains 文件下面的虚拟域条目应该这样写: Returning to the example scenario above, if the example.net mail administrator wanted to create a virtual domain, virtual.example.com, under the administrative control of user john, the following entry in virtualdomains would accomplish that:
virtual.example.com:john
这样, 发往 joe@virtual.example.com 的邮件将会被修改为发往 john-joe@virtual.example.com , 然后进行本地传送. 更多信息, 请参见 .qmail 小节, 以及 扩展地址 细目. 那里将介绍 john 如何管理他的虚拟域. An incoming message to joe@virtual.example.com would be rewritten as john-joe@virtual.example.com and delivered locally. See the .qmail section, and the extension addresses subsection for more information about how john can manage his virtual domain.
使用多主机名的时候, 所有的虚拟域都必须在rcphosts列出, 这样 qmail-smtpd 才会知道那些地址应该被接受. 但是不像多主机名方式, 虚拟域不可以在locals里面设置相应条目. As with multiple host names, all virtual domains must be listed in rcpthosts so qmail-smtpd will know to accept messages addressed to them. However, unlike multiple host names, virtual domains must not be added to locals.
修改 virtualdomains文件之后, 发送给 qmail-send 一个 HUP (挂起) 信号, 通知它重新读取配置文件. 如果你使用本文的 qmailctl 脚本, 你可以运行如下命令: After modifying virtualdomains, send qmail-send a HUP (hangup) signal to tell it to reread the file. If you have qmailctl, you can do:
qmailctl reload
同时, 不要忘了在 rcpthosts 里面增加虚拟域条目. Don't forget to add virtual domains to rcpthosts, too.
注意: 域名服务器(DNS)的邮件交换器(MX)记录必须被设置为把虚拟域指向恰当的邮件服务器. 这是名字服务器管理员的工作, 超出了本文讨论的范围. Note: Domain name server (DNS) mail exchanger (MX) records must be set up to direct messages for virtual domains to the appropriate mail server. This is a job for the name server administrator and is beyond the scope of this guide.
3.5. 别名 Aliases
qmail的标准别名机制是由qmail的本地传送机制自然派生出来的.qmail-local 试图传送地址为 localpart@host 的邮件给本地叫做 localpart 名字的用户. 如果没有匹配这个名字的用户存在, 邮件将会被发送给别名 alias 用户, 别名用户是qmail系统里面通常主目录位于 /var/qmail/alias 的伪用户. qmail's standard aliasing mechanism is a natural outgrowth of qmail's local delivery mechanism. qmail-local attempts to deliver a message addressed to localpart@host to a local user named localpart. If no matching user is found, the message is delivered to the alias user, a pseudo-user on all qmail systems whose home directory is usually /var/qmail/alias.
举例, 如果你想要创建一个叫做 info@example.com 的别名, 这个别名用户将把上文收到的所有无主邮件转发给用户 tom, 在我们举例的 example.com 上, 这样作的方式是: 作为 root 用户, 运行下面的命令: For example, say you want to create an info@example.com alias that forwards messages to user tom. On example.com, do, as user root:
echo \&tom > /var/qmail/alias/.qmail-info
.qmail 小节, 以及 扩展地址 细目介绍了如何创建 .qmail文件, 这些文件确定了那些别名存在, 以及如何处理哪些发给他们的邮件的. The .qmail section and extension addresses subsection describe how to create .qmail files that specify which aliases exist, and what to do with messages sent to them.
附录 Gotchas 介绍了两个关于别名应用的复杂案例. 那些别名使用了大写字母和小数点("."), 以及 .qmail 文件的 man 手册页面, 其中包含了完整的关于 .qmail 文件用法的文档. The Gotchas appendix covers a couple of tricky cases regarding the usage of alias--aliases containing uppercase characters and dots ('.')--and man dot-qmail contains complete documentation of the usage of .qmail files.
注意由于别名在 qmail 里面的实现方式, 别名是不能够重载一个合法用户的传送的. 例如, 如果 rachel 是一个普通用户, 那么~alias/.qmail-rachel 别名是无效的. Note that because of the way aliases are implemented in qmail, an alias can never override a valid user's deliveries. E.g., if rachel is a normal user, ~alias/.qmail-rachel will not be used.
fastforward 软件包另外提供了一个可行的别名机制, 它将多个别名放入单独一个和Sendmail别名数据库兼容的文件里面. The fastforward package provides an alternative aliasing mechanism that puts multiple aliases in a single file compatible with Sendmail's alias database.
下一节, qmail-users, 描述了其他实现别名的机制. The next section, qmail-users, describes another mechanism that can be used to implement aliases.
3.6. 关于 qmail-users qmail-users
qmail-users 是一个分发地址给用户的系统. 由 /var/qmail/users 下的一系列文件构成. assign 文件是一个分配表. 有两种分配表的格式: 单体方式和通配符方式. qmail-users is a system for assigning addresses to users. A series of configuration files resides under /var/qmail/users. The assign file is a table of assignments. There are two kinds of assignments: simple and wildcard.
注意: assign 文件包含了一系列分配表, 每行一个, 后面接一个包含了一个单独的小数点(.)的行. 如果你手动创建assign文件, 不要忘记小数点那一行. Note: assign contains a series of assignments, one per line, followed by a line containing a single dot (.). If you create assign manually, don't forget the dot line.
3.6.1. 单体分配表 Simple assignment
一个单体分配表看起来是这个样子的: A simple assignment looks like:
=address:user:uid:gid:directory:dash:extension:
这个表的含义是: 作为 address 地址接收的邮件将会被使用用户 user 来传送, 使用指定的 uid 和 gid, 并且由 directory/.qmaildashextension 这个文件决定邮件如何被传送. What this means is that messages received for address will be delivered as user user, with the specified uid and gid, and the file directory/.qmaildashextension will specify how the messages are to be delivered.
3.6.2. 通配符分配表 Wildcard assignment
通配符分配表看起来是这个样子的: A wildcard assignment looks like:
+prefix:user:uid:gid:directory:dash:prepend:
这个表的含义是: 作为 prefixrest 地址里面匹配的邮件地址接收的邮件, 将会被使用用户 user 来传送, 使用指定的 uid 和 gid, 并且由 directory/.qmaildashextension 这个文件决定邮件如何被传送. What this means is that messages received for addresses of the form prefixrest will be delivered as user user, with the specified uid and gid, and the file directory/.qmaildashprependrest will specify how the messages are to be delivered.
3.6.3. qmail-user 程序 qmail-user programs
qmail-user 有两个辅助程序: qmail-newu 和 qmail-pw2u. qmail-user has two helper programs: qmail-newu and qmail-pw2u.
qmail-newu 程序处理 assign 文件并且在 /var/qmail/users 下生成一个名为 cdb 的常量数据库(CDB)文件. CDB是二进制格式, 所以在内含数千条分配表的情况下, 仍然可以被 qmail-lspawn 快速访问. qmail-newu processes the assign file and generates a constant database (CDB) file called cdb in /var/qmail/users. CDB is a binary format that can be accessed quickly by qmail-lspawn, even when there are thousands of assignments.
qmail-pw2u 把系统用户数据库 /etc/passwd 转换为一系列适于 assign 的分配表. qmail-pw2u 使用一套文件集来修改翻译规则. qmail-pw2u converts the system user database, /etc/passwd, into a series of assignments suitable for assign. qmail-pw2u uses a set of files to modify the translation rules.
- include: 要包括的用户 include: users to include
- exclude: 不要包括的用户 exclude: users to exclude
- mailnames: 用户的可替换的"邮件帐户名字" mailnames: alternative "mailnames" for users
- subusers: 用户控制的额外的地址, 使用可选的 .qmail 扩展方式 subusers: extra addresses handled by a user, with an optional .qmail extension
- append: 其他分配表 append: miscellaneous assignments
注意: 如果你使用qmail-pw2u, 不要忘记在增加和删除用户, 或者改变UID和GID之后, 重新运行一下qmail-pw2u和qmail-newu. 标准的运行次序如下所示: Note: If you use qmail-pw2u, don't forget to re-run qmail-pw2u and qmail-newu whenever you add users, remove users, or change UID's or GID's. A typical sequence would be:
qmail-pw2u </etc/passwd >/var/qmail/users/assign
qmail-newu
3.7. 反垃圾邮件 Spam Control
Chris Hardie 写了一个极好的的qmail反垃圾邮件 HOWTO. 可以在这个地址访问到它: http://www.summersault.com/chris/techno/qmail/qmail-antispam.html. Chris Hardie has written an excellent qmail Anti-Spam HOWTO. It's available from http://www.summersault.com/chris/techno/qmail/qmail-antispam.html.
3.8. 病毒扫描 Virus Scanning
Jason Haar编写了 Qmail-Scanner, 一个为qmail设计的内容扫描装置. 更多信息请参见 http://qmail-scanner.sourceforge.net/. Jason Haar has written Qmail-Scanner, a content scanning harness for qmail. See http://qmail-scanner.sourceforge.net/ for more information.
Qmail-Scanner 包括了一个简单的内置扫描器, 不过严肃一些的内容扫描需要一个单独的病毒扫描程序--可以是一个Qmail-Scanner支持的商业扫描程序, 或者选用 Tomasz Kojm 的免费的 Clam Antivirus 扫描器, 可以在 http://clamav.elektrapro.com/ 这个地址找到它. Qmail-Scanner includes a simple built-in scanner, but serious scanning requires a separate virus scanner--either one of the supported commercial scanners or Tomasz Kojm's free Clam Antivirus scanner, available from http://clamav.elektrapro.com/.
4. 使用方法 Usage
这一节介绍了qmail 针对普通用户的使用方法. 如果你在 qmail 系统上读信和发信, 那么你阅读本节就可以找到如何用qmail 达成你的目的了. This section covers the usage of qmail by normal users. If you read or send mail on a qmail system, this is where you'll find information about how to do that with qmail.
4.1. .qmail 文件 .qmail files
传送用户邮件通常是由一个或者几个 ".qmail"(发音 dot kyoo mail) 文件控制的. 这些文件位于用户的主目录, 文件名由 .qmail 开头. .qmail 的man 手册页面描述了 .qmail 文件使用方法. Delivery of a user's mail is usually controlled by one or more ".qmail" (pronounced dot kyoo mail) files--files in the user's home directory with names beginning with .qmail. The dot-qmail man page describes .qmail file usage.
.qmail 文件包括了一个传送指令清单, 每行一个指令. 每行的第一个字符决定了选择那种传送方式. .qmail files contain a list of delivery instructions, one instruction per line. The first character of the line determines what kind of delivery is involved:
| 字符 Character | 传送类型 Delivery Type | 值 Value |
| # | 无 (注释) none (comment) | 忽略的 ignored |
| | | 程序 program | 由shell 执行的命令 command to be run by shell |
| / 或者 . | mbox邮箱格式 (如果路径最后一个字符不是一个斜杠) mbox (if last char isn't a /) |
mbox 的路径名 (包括斜杠"/"或者 点".") pathname of mbox (including the / or .) |
| / 或者 . | maildir邮箱格式 (如果路径最后一个字符是一个反斜杠) maildir (if last char is a /) | maildir 的路径名 (包括斜杠"/"或者 点".") pathname of maildir (including the / or .) |
| & | 转发 forward | 转发邮件的地址 address to forward message |
| 字母或者数字 letter or number | 转发 forward | 转发邮件的地址 (包括第一个字符) address to forward message (including the first char) |
4.1.1. 程序传送 program delivery
如果指令是由程序传送, qmail 启动一个 shell (/bin/sh) 来执行这个命令, 然后把邮件的一个副本从标准输入传送给这个命令. qmail-command 的 man 手册页记录了这个过程的细节. When a program delivery instruction is encountered, qmail starts a shell (/bin/sh) to execute the command and feeds the command a copy of the incoming message on standard input. The qmail-command man page documents the details of this process.
程序传送是非常强大的, 被用来实现的功能范围非常广阔, 例如邮件过滤, 自动回复, 以及通过第三方传送代理比如procmail来传送邮件. Program delivery is very powerful, and can be used to implement a wide range of functionality such as message filtering, automatically responding to messages, and delivery via third-party delivery agents such as procmail.
例如: E.g.:
|preline /usr/ucb/vacation djb
这个指令操作qmail 启动preline, 将 /usr/ucb/vacation 和 djb 作为参数传送给 preline, 并且在标准输入传送邮件的副本给这个命令. This causes qmail to start preline, pass it /usr/ucb/vacation and djb as arguments, and provide a copy of the message on standard input.
4.1.2. mbox 格式邮箱的邮件投递 mbox delivery
mbox 是标准的UNIX邮箱格式, 多个邮件存放在一个独立文件内, 每个邮件由一个"From" 的行开始. 这一行看起来像一个标题字段, 不过那不是标题, 那仅仅是传送代理添加的, 便于邮件读出器可以找到每个邮件开始部分的一个标记. Mbox is the standard UNIX mailbox format in which multiple messages are stored in a single file and messages are headed with a "From " line. This line looks like a header field, but it isn't one: it's just something the delivery agent adds so mail readers can tell where each message begins.
例如: E.g.:
./Mailbox
这个设置表示邮件将被追加到 $HOME/Mailbox 文件上, 每个邮件由"From"引领. 一个存放了一个单独邮件的简单的mbox 的邮箱看起来是下面这个样子的: This causes messages to be appended to $HOME/Mailbox, with a "From " line prepended. A simple mbox mailbox with a single message looks like:
From user1@example.net Thu May 13 18:34:50 1999
Received: (qmail 1287205 invoked from network); 13 May 1999 18:34:49 -0000
From: user1@example.net
To: user2@example.com
Subject: hey
What's up?
第一行是 qmail 传送邮件时添加的. The first line was added at delivery by qmail.
4.1.3. maildir 格式邮箱的邮件投递 maildir delivery
maildir 是 Dan Bernstein 为了表明 mbox 邮箱格式的缺陷而创造的格式. 一个 maildir 邮箱包含三个子目录, new, cur, 和 tmp. 在各个子目录下的每个邮件根据状态的不同分别存储在各个子目录下独立的文件中. 未读邮件存储在new中, cur存储已读邮件, tmp 是为那些正在传送过程中的邮件使用的. maildir 的man手册页详细描述了maildir格式的细节. Maildir is a mailbox format created by Dan Bernstein to address the shortcomings of the mbox format. A maildir mailbox is a directory containing three subdirectories, new, cur, and tmp. Each message in a maildir mailbox is in a separate file in one of the subdirectories, depending upon its status: new is for unread messages, cur is for messages that have been seen, and tmp is for messages in the process of being delivered. The maildir man page describes the format of a maildir in detail.
maildir 格式的优点之一就是保证邮件传输的安全, 即使在不锁定情况下, 不同邮件代理同时更新邮件, 也能保证传输的可靠. 这意味着maildir 邮箱可以安全的建立在以NFS性质挂接的文件系统上. One of the benefits of the maildir format is that, even though it doesn't use locking to prevent simultaneous updates from different delivery agents, it's reliable. This means maildir mailboxes can safely reside on NFS-mounted filesystems.
例如: E.g.:
./Maildir/
这个设置表示将把邮件存储在 $HOME/Maildir 下面的 maildir 格式的邮箱. This causes messages to be saved in $HOME/Maildir, a maildir-format mailbox.
注意: qmail-local 可以将邮件传送到 maildir 格式邮箱, 但是不能创建这种邮箱. 你需要使用qmail 附带的maildirmake 程序来创建 maildir 格式邮箱. 例如: "maildirmake ~/Maildir". 不过要确定你使用maildir的拥有者运行maildirmake, 而不是 root 用户. 另外的方式, 你的 useradd 和 adduser 命令可能支持"skeleton"骨架目录, 例如: /etc/skel, 然后可以直接复制这个目录给所有新用户. Note: qmail-local can deliver mail to maildir mailboxes, but it can't create them. Maildir mailboxes should be created with the maildirmake program that comes with qmail. E.g., "maildirmake ~/Maildir". Be sure to run maildirmake as the owner of the maildir, not as root. Your useradd or adduser command might support a "skeleton" directory, e.g. /etc/skel, where you can create a maildir that will be copied for all new users.
4.1.4. 转发邮件 forward delivery
转发邮件就是将邮件重发到指定地址. 由.qmail文件内的命令不能包含注释部分和多余的空格. Forward deliveries causes the message to be resent to the specified address. Addresses specified in .qmail files can't contain comment fields or extra spaces.
下面的写法是错的: These are wrong:
&<user@example.com>
& user@example.com
&Joe User <user@example.com>
下面的是正确的写法: These are correct:
&user@example.com
user@example.com
&user
前两个将邮件副本转发给 user@example.com, 最后一个将邮件副本转发给本地用户 user. The first two cause user@example.com to receive a copy of the message. The last sends a copy to the local user user.
4.1.5. 扩展地址 extension addresses
qmail 支持用户控制扩展地址. 在基本地址 username@hostname.domain 上扩展的扩展地址为: username-extension@hostname.domain ,用户同样可以接收发往扩展地址的邮件. 在本节其余部分, 我们讨论的范围都是在本地系统上, 所以我们将不再使用"@hostname.domain" 部分. qmail supports user-controlled extension addresses. In addition to the base address, username@hostname.domain, users can receive mail at username-extension@hostname.domain. For the remainder of this section, I'll leave off the "@hostname.domain" part since we're considering actions that take place on the local system.
对于型如username-extension 的扩展地址的传送指令由用户目录下的~username/.qmail-extension 文件指定. The delivery instructions for username-extension are in ~username/.qmail-extension.
举一个例子, dave-lwq@sparge.example.com 这个扩展地址的传送将由文件 ~dave/.qmail-lwq 来控制. For example, dave-lwq@sparge.example.com is controlled by ~dave/.qmail-lwq on host sparge.
扩展地址可以拥有多个字段, 例如 dave-list-qmail 这个扩展地址, 由 ~dave/.qmail-list-qmail 来控制. 在这个例子里面, dave-list-qmai 这个地址被用来订阅 qmail 的邮件列表, ~dave/.qmail-list-qmail 则负责归档这个列表的邮件到单独的邮箱里面. Extensions can have multiple fields, e.g., dave-list-qmail, controlled by ~dave/.qmail-list-qmail. In this example, dave-list-qmail is subscribed to the qmail mailing list, and ~dave/.qmail-list-qmail files the list messages in a separate mailbox.
.qmail 文件可以用-default 后缀进行匹配。 所以 dave-list-qmail 可以由 ~dave/.qmail-list-default 操作. 这个文件可以一对多方式用一个.qmail文件控制所有型如 dave-list-加上任何后缀的地址. 注意 dave-list 不能由 ~dave/.qmail-list-default 控制, 因为在"list"后面没有"-". qmail files can be wildcarded using -default. So dave-list-qmail could also be handled by ~dave/.qmail-list-default. This would allow one catch-all .qmail file to handle all dave-list-whatever addresses. Note that dave-list wouldn't be handled by ~dave/.qmail-list-default because it doesn't match the "-" after "list".
qmail 会使用最接近的匹配方式. 例如, qmail在传送一个标志着送给dave-list-qmail这个地址的邮件时, 会按照下面顺序查找.qmail控制文件, 并按照最先匹配的.qmail文件传送这个邮件. qmail uses the closest match it finds. E.g., when a message comes in addressed to dave-list-qmail, it'll use the first one of the following that it finds:
.qmail-list-qmail
.qmail-list-default
.qmail-default
如果没有找到相匹配的.qmail文件, 传送失败, 并且将邮件反弹给发送者. If no matching .qmail file is found, the delivery fails and the message bounces back to the sender.
4.2. 发送邮件 Sending messages
邮件用户通常并不直接发送邮件. 典型的方式是利用邮件用户代理(Mail User Agent, MUA)程序, 例如 pine 或者 mutt 编写并发送邮件. MUA程序调用MTA传送邮件. 这个处理邮件到MTA的调用过程称为注入(injection). Mail users usually don't use the MTA directly to send messages. Typically, messages are composed and sent using a Mail User Agent (MUA) such as pine or mutt, which then calls the MTA to deliver the message. The process of handing a message to the MTA is called injection.
有两种方式完成注入, 一种利用SMTP协议(Simple Mail Transfer Protocol, SMTP), 或者利用MTA提供的的特定程序. There are two ways to inject messages into most MTA's: via the Simple Mail Transfer Protocol, SMTP, or using a program provided by the MTA for that purpose.
4.2.1. SMTP 方式 SMTP
MUA程序可以使用TCP协议连接到标准的SMTP协议端口25, 可以是本地主机或者指定的邮件服务器. MUA和MTA后续进行的回话导致两个结果: MUA's can open a TCP connection to port 25, the standard SMTP port, on the local host or a designated mail server. The MUA and the MTA then engage in a dialogue that results in either:
- 邮件被传送给MTA, 或者the message being transfered to the MTA, or
- 返回一份错误报告给MUA a error status being returned to the MUA
SMTP没有身份认证的机制, 所以发送邮件的过程是不要求用户名和密码的. 但是, 大多数MTA拒绝接收既不是来自本地用户也不是发送给本地用户的邮件的. 如果一个恰当的格式的邮件被MTA拒绝, 最大的可能就是转信限制造成. 参见转信小节查看更多的如何配置转信的信息. SMTP has no mechanism for authentication, so no username or password is required to send a message. However, many MTA's refuse to accept messages that don't appear to be either from or for a local user. If a properly formatted message is rejected, relaying restrictions are the most likely cause. See the Relaying section for more information about relay configuration.
4.2.2. /var/qmail/bin/sendmail 文件 /var/qmail/bin/sendmail
很多年以来, UNIX MTA一直都是Sendmail. 由于Sendmail的应用十分普遍, 许多程序员假定它是默认的MTA. 结果, Sendmail的本地注入机制成为标准的本地邮件注入的应用编程接口(Application Programmer's Interface, API). qmail 以及其他非Sendmail的MTA因此也提供一个sendmail程序应用于本地注入方式上, 它的工作方式和真正的Sendmail 的 sendmail程序一样. Sendmail For many years, Sendmail was the UNIX MTA. It was so ubiquitous, that many programmers just assumed that it was the MTA. As a result, Sendmail's local injection mechanism became the standard Application Programmer's Interface (API) for local mail injection. qmail and other non-Sendmail MTA's provide a sendmail program that works the same way as the real Sendmail's sendmail for local injection.
qmail 的用于替换Sendmail相应部分的 sendmail 程序, 通常位于 /var/qmail/bin/sendmail, 典型的Sendmail的程序包括下面这些位置: The qmail sendmail, which is normally in /var/qmail/bin/sendmail, usually replaces the Sendmail sendmail on qmail systems. Typical locations of the sendmail program include:
- /usr/lib/sendmail
- /usr/sbin/sendmail
在qmail系统里面, 使用命令"ls -l path-to-sendmail"将会显示出, sendmail实际上是一个指向/var/qmail/bin/sendmail 的符号连接. On a qmail system, "ls -l path-to-sendmail" should show that sendmail is a symbolic link to /var/qmail/bin/sendmail:
$ ls -l /usr/lib/sendmail
lrwxrwxrwx 1 root root 29 Feb 19 11:04 /usr/lib/sendmail -> /var/qmail/bin/sendmail
4.2.3. qmail-inject qmail-inject
除了模仿 sendmail 的 API之外, qmail 也拥有自己的注入程序: qmail-inject. 实际上, qmail提供的sendmail 程序只是一个qmail-inject的外壳程序. In addition to emulating the sendmail API, qmail has its own injection program: qmail-inject. In fact, sendmail is just a wrapper around qmail-inject.
作为一个API标准, sendmail可能更好用, 因为它使用广泛. qmail的API由qmail-inject提供, 只能在qmail系统下运行, 而sendmail接口几乎是通用的. As an API, sendmail is probably better because it's much more widely available. The qmail API provided by qmail-inject will only work on systems with qmail, but the sendmail interface is nearly universal.
举一个例子, 可以这样发送一个空白邮件给 joe@example.com: For example, to send a blank message to joe@example.com:
echo To: joe@example.com | /var/qmail/bin/qmail-inject
4.3. 环境变量 Environment Variables
一些qmail程序设定和使用环境变量, 下面的表格列出了这些变量并且描述了他们的用法. Some qmail programs set or use environment variables. The following table lists these variables and describes their use.
| 名字 Name | Man 帮助页Man page | 设置/使用Set or used | 使用目的 Purpose |
| DATABYTES | qmail-smtpd | 使用 used | 重载control/databytes文件 Overrides control/databytes |
| DEFAULT | qmail-command | 设置 set | 在.qmail文件名中匹配"-default"的地址部分 Portion of address matching "-default" in a .qmail file name. |
| DTLINE | qmail-command | 设置 set | 邮件头Delivered-To部分 Delivered-To header field |
| EXT | qmail-command | 设置 set | 地址扩展 The address extension |
| EXT2 | qmail-command | 设置 set | 第一个破折号后面的EXT的一部分 Portion of EXT following first dash |
| EXT3 | qmail-command | 设置 set | 第二个破折号后面的EXT的一部分 Portion of EXT following second dash |
| EXT4 | qmail-command | 设置 set | 第三个破折号后面的EXT的一部分 Portion of EXT following third dash |
| HOME | qmail-command | 设置 set | 用户的主目录 The user's home directory |
| HOST | qmail-command | 设置 set | 接收地址的域名部分 The domain part of the recipient address |
| HOST2 | qmail-command | 设置 set | 在最后的点前面的HOST部分 Portion of HOST preceding last dot. |
| HOST3 | qmail-command | 设置 set | 在倒数第二个的点前面的HOST的一部分 Portion of HOST preceding second-to-last dot |
| HOST4 | qmail-command | 设置 set | 在倒数第三个的点前面的HOST的一部分 Portion of HOST preceding third-to-last dot |
| LOCAL | qmail-command | 设置 set | 接收地址的local部分 The local part of the recipient address |
| LOGNAME | qmail-inject | 使用 used | 在邮件头From中的用户名(4) User name in From header field (4) |
| MAILHOST | qmail-inject | 使用 used | 在邮件头From中的主机名(2) Host name in From header field (2) |
| MAILNAME | qmail-inject | 使用 used | 在邮件头From中的个人姓名(2) Personal name in From header field (2) |
| MAILUSER | qmail-inject | 使用 used | 在邮件头From中的用户名(2) User name in From header field (2) |
| NAME | qmail-inject | 使用 used | 在邮件头From中的个人姓名(3) Personal name in From header field (3) |
| NEWSENDER | qmail-command | 设置 set | 转发的发送人地址(参考命令"man dot-qmail") Forwarding sender address (see "man dot-qmail") |
| QMAILDEFAULTDOMAIN | qmail-inject | 使用 used | 重载ontrol/defaultdomain 文件 Overrides control/defaultdomain |
| QMAILDEFAULTHOST | qmail-inject | 使用 used | 重载control/defaulthost 文件 Overrides control/defaulthost |
| QMAILHOST | qmail-inject | 使用 used | 在邮件头From中的主机名(1)Host name in From header field (1) |
| QMAILIDHOST | qmail-inject | 使用 used | 重载control/idhost 文件 Overrides control/idhost |
| QMAILINJECT | qmail-inject | 使用 used | 指定几个选项(参见下面的表格) Specify various options (see next table) |
| QMAILMFTFILE | qmail-inject | 使用 used | 包含下一级跟踪的邮件地址列表的文件 File containing list of mailing list addresses for Mail-Followup-To generation |
| QMAILNAME | qmail-inject | 使用 used | 在邮件头From中的个人姓名(1) Personal name in From header field (1) |
| QMAILPLUSDOMAIN | qmail-inject | 使用 used | 重载 control/plusdomain 文件 Overrides control/plusdomain |
| QMAILSHOST | qmail-inject | 使用 used | 信封上发送者地址中的主机名 Host name in envelope sender address |
| QMAILSUSER | qmail-inject | 使用 used | 信封上发送者地址中的用户名 User name in envelope sender address |
| QMAILUSER | qmail-inject | 使用 used | 在邮件头From中的用户名(1) User name in From header field (1) |
| RECIPIENT | qmail-command | 设置 set | 信封上接收者的地址 Envelope recipient address |
| RELAYCLIENT | qmail-smtpd | 使用 used | 忽略 control/rcpthosts 文件然后在接收地址后添加值 Ignore control/rcpthosts and append value to recipient address |
| RPLINE | qmail-command | 设置 set | 邮件头返回路径 Return-Path header field |
| SENDER | qmail-command | 设置 set | 信封上发送者地址Envelope sender address |
| UFLINE | qmail-command | 设置 set | UUCP风格的"From"行 UUCP-style "From " line |
| USER | qmail-command | 设置 set | 当前的用户 The current user |
| USER | qmail-inject | 使用 used | 邮件头From中的用户名 User name in From header field (3) |
| 字母 Letter | 使用目的 Purpose |
| c | 为From部分使用地址注释风格Use address-comment style for the From field |
| s | 不考虑任何进入邮件的返回路径部分 Do not look at any incoming Return-Path field |
| f | 删除所有进入邮件的From部分 Delete any incoming From field |
| i | 删除所有进入邮件的Message-ID部分 Delete any incoming Message-ID field |
| r | 使用每接收者VERP Use a per-recipient VERP |
| m | 使用每邮件VERP Use a per-message VERP |
5. 高级话题 Advanced Topics
5.1. 关于 procmail
procmail 是一个流行的邮件传送代理( Message Delivery Agent , MDA). MDA的功能是从MTA为特定用户或者邮箱接收邮件, 然后按照用户的要求传送邮件的程序. procmail 可以用来针对邮件主体或者不同的邮件头内容过滤邮件. 举一个例子, 从某个特定的人发来的邮件可以被定向传送到某个专门为这个人准备的邮箱. procmail is a popular Message Delivery Agent (MDA). The function of an MDA is to accept a message from the MTA for a specific user or mailbox, and deliver the message according to the user's desires. procmail can be used to "filter" messages by the content of various header fields or the body of the message. For example, messages from a particular person can be directed to a mailbox for just that person.
在qmail上应用procmail有两个技巧. 第一个, procmail 通常被配置成传送邮件到/var/spool/mail 下的邮箱. 你可以重新设置安装procmail到缺省的$HOME路径下, 或者指导用户不要依赖procmail 投递邮件到默认的mbox位置. 除非你为$HOME邮件投递打补丁, 否则, procmail依然会使用/var/spool/mail 作为临时文件. There are a couple tricks to running procmail with qmail. First, procmail is usually built to deliver to an mbox mailbox in /var/spool/mail. You can rebuild procmail to default to $HOME or you can instruct users not to rely on procmail to default the location of the mbox. Unless you patch it for $HOME delivery, procmail will still use /var/spool/mail for temporary files.
另外一个问题是qmail-command和procmail使用的退出码是不同的. procmail使用的是标准UNIX退出码: 零代表成功, 非零代表失败, 失败的原因由/usr/include/sys/errno.h 定义. qmail-command 使用某个非零码指示永久错误, 其余作为临时码. 解决方式可以应用一个小的shell脚本为 qmail-command 翻译退出码. 这样的一个shell脚本曾经在qmail 邮件列表刊登, 现在被存档在这个位置http://www.ornl.gov/its/archives/mailing-lists/qmail/1998/04/msg00487.html. Another problem is that qmail-command and procmail don't have a common understanding of which exit codes mean what. procmail uses the standard UNIX exit codes: zero means success, nonzero means failure, and the cause of the failure is indicated by /usr/include/sys/errno.h. qmail-command uses certain nonzero codes to indicate permanent errors and the rest are considered temporary. A small shell script wrapper can be used to translate the exit codes for qmail-command. Such a wrapper was posted to the qmail list and is available from the archives at http://www.ornl.gov/its/archives/mailing-lists/qmail/1998/04/msg00487.html.
同样的情况, 旧版本的procmail(3.14之前)不能直接传送邮件给maildir格式的邮箱. 最好的办法是升级你的procmail到最新版本. 另外一个解决办法是使用safecat, 这个程序将标准输入的邮件写入指定的maildir格式的邮箱. 用户可以使用 procmail 处方(传送指令)来使用safecat 保存邮件. 也可以完全跳过procmail, 使用maildrop. Also, older versions of procmail (prior to 3.14) don't deliver directly to maildir-format mailboxes. Your best bet is to upgrade to the current version of procmail. Another approach is safecat, a program that writes a message on standard input to a specified maildir. Users can write procmail recipes (delivery instructions) that use safecat to file the message. You can also skip procmail altogether, and use maildrop.
最后, procmail 认为邮件将被接收到mbox格式的邮箱, 常规的qmail传送程序仅仅包括实际的邮件, 而不包括"From"行. 这里可以使用preline 命令来格式化邮件, 以保证procmail的要求. 上面链接的脚本就包括了 preline. Finally, procmail expects the messages it receives to be in mbox format. Normal qmail program deliveries include only the actual mail message, not including a "From " line. The preline command can be used to format the message as procmail expects. The wrapper linked above includes preline.
举一个例子, 假设用户"dave"希望用procmail来处理他的邮件. 他的系统管理员设置procmail来传送邮件到默认的$HOME, 并且已经配置好了上面的退出码翻译脚本程序, 位置在 /usr/local/bin/qmail-procmail, 那么他的.qmail文件应该是这个样子的: For example, let's say user "dave" wants his mail to be processed by procmail. His system administrator has built procmail to deliver to $HOME by default, and has provided the exit code wrapper linked above, called /usr/local/bin/qmail-procmail. His .qmail file should look like:
|/usr/local/bin/qmail-procmail
5.2. POP 和 IMAP 服务器 POP and IMAP servers
qmail包括一个POP服务器, qmail-pop3d, 不过并没有作为qmail\安装过程的一部分. 你可以选用其他POP或者IMAP服务器, 尽管他们大多数都是为Sendmail编写的, 在qmail下运行这些服务器时, 需要作一些额外工作. qmail includes a POP server, qmail-pop3d, but it's not configured and installed as part of the qmail installation process. You can also use one of the other POP or IMAP servers available, although most of them were written for Sendmail and will require some work to use with qmail.
5.2.1. qmail-pop3d
qmail-pop3d 是qmail自带的很不错的POP服务器. 很多qmail站点都使用它作为POP服务器. 它是模块化的, 可以通过不同的认证模块支持多种认证方案. qmail-pop3d is the POP server included with qmail. It's a fine POP server, and many qmail sites use it. It's modular, and supports multiple authentication schemes via alternative authentication modules.
注意: qmail-pop3d只支持maildir格式的邮箱, 所以如果你的用户登录到POP服务器并且在本地运行MUA程序, 这些程序必须支持maildir格式的邮箱. 如果所有用户都是通过POP来读取邮件, 那么服务器端的邮箱格式就不是什么问题了. Note: qmail-pop3d supports only maildir-format mailboxes, so if you have users logging into the POP server and running MUA's locally, they all have to support maildir. If all of your users read mail via POP, the mailbox format on the server is not an issue.
5.2.1.1. qmail-pop3d的结构 Architecture of qmail-pop3d
qmail-pop3d服务器包括三个模块: A qmail-pop3d server consists of three modules:
- qmail-popup: 取得用户名/密码 qmail-popup--gets username/password
- checkpassword: 鉴别用户名/密码 checkpassword--authenticates username/password
- qmail-pop3d: POP后台服务程序 qmail-pop3d--the POP daemon
典型的, qmail-popup由inetd 或者 tcpserver运行, 在110端口监听, 一旦有连接, 它将提示输入用户名和密码, 然后它调用checkpassword来校验用户名/密码, 通过校验后调用qmail-pop3d. Typically, qmail-popup is run via inetd or tcpserver, listening to port 110, the POP3 port. When a connection is made, it prompts for the username and password. Then it invokes checkpassword, which verifies the username/password and invokes qmail-pop3d if they match.
5.2.1.2. 安装 qmail-pop3d Installation of qmail-pop3d
1. 完整安装并测试qmail. 如果你希望所有用户都拥有POP可收发的邮箱, 确定 defaultdelivery 参数已经设置为 ./Maildir/. 如果你是按照本文的安装小节安装的qmail, /var/qmail/rc脚本已经被安装到恰当位置, 那么在文件 control/defaultdelivery 中配置了这个参数. 如果不是这样安装的, 可能在/var/qmail/rc 的 qmail-start 命令行上. 1. Completely install and test qmail. If you want all users to have POPable mailboxes, make sure defaultdelivery is set to ./Maildir/. If you installed the /var/qmail/rc script from the Installation section, this is configured in control/defaultdelivery. If not, it's probably in /var/qmail/rc on the qmail-start command line.
2. 从http://www.qmail.org/top.html#checkpassword下载checkpassword 程序. 如果你不需要其他特别的东西, 也可以在http://cr.yp.to/checkpwd.html 下载标准的checkpassword程序. 2. Download a checkpassword program from http://www.qmail.org/top.html#checkpassword. The standard checkpassword, http://cr.yp.to/checkpwd.html, is a good choice if you don't need anything fancy.
3. 按照安装指导编译并安装checkpassword程序. 确定你安装程序到 /bin/checkpassword 下. Compile and install checkpassword according to the directions. Make sure you install it as /bin/checkpassword.
4. 创建一个/var/qmail/supervise/qmail-pop3d/run 脚本, 包括如下内容: Create a /var/qmail/supervise/qmail-pop3d/run script containing:
#!/bin/sh
exec /usr/local/bin/softlimit -m 2000000 \
/usr/local/bin/tcpserver -v -R -H -l 0 0 110 /var/qmail/bin/qmail-popup \
FQDN /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir 2>&1
这里 FQDN 是你建立的POP服务器的完整的有资格的正式域名, 例如, pop.example.net. where FQDN is the fully qualified domain name of the POP server you're setting up, e.g., pop.example.net.
注意: 由softlimit命令指定的内存使用限度是可以依赖于你是用的的硬件平台和操作系统适当提高的. 当连接到110端口失败或者POP3连接以难以理解的方式失败情况下, 试着将这个参数提高到3000000或者5000000. Note: The memory limit specified in the softlimit command may need to be raised depending upon your operating system and hardware platform. If attempts to connect to port 110 fail or POP3 connections fail mysteriously, try raising it to 3000000 or 5000000.
5. 创建包括以下内容的/var/qmail/supervise/qmail-pop3d/log/run 文件. 5. Create a /var/qmail/supervise/qmail-pop3d/log/run script containing:
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t \
/var/log/qmail/pop3d
6. 建立log日志文件夹并且设置相应的run脚本, 将脚本链接到 /service 目录: 6. Set up the log directory and permissions on the run scripts, and link the service into /service:
chmod +t /var/qmail/supervise/qmail-pop3d # if daemontools < 0.75
mkdir /var/log/qmail/pop3d
chown qmaill /var/log/qmail/pop3d
chmod 755 /var/qmail/supervise/qmail-pop3d/run
chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
ln -s /var/qmail/supervise/qmail-pop3d /service
7. 将下面内容加入qmailctl脚本的"start"部分 7. Add the following to qmailctl's "start" section:
if svok /service/qmail-pop3d ; then
svc -u /service/qmail-pop3d /service/qmail-pop3d/log
else
echo qmail-pop3d supervise not running
fi
8. 将下面内容加入qmailctl脚本的"stop"部分 8. Add the following to qmailctl's "stop" section:
echo " qmail-pop3d"
svc -d /service/qmail-pop3d /service/qmail-pop3d/log
9. 将下面内容加入qmailctl脚本的"stat"部分 9. Add the following to qmailctl's "stat" section:
svstat /service/qmail-pop3d
svstat /service/qmail-pop3d/log
10. 将下面内容加入qmailctl脚本的"pause"部分 10. Add the following to qmailctl's "pause" section:
echo "Pausing qmail-pop3d"
svc -p /service/qmail-pop3d
11. 将下面内容加入qmailctl脚本的"cont"部分 11. Add the following to qmailctl's "cont" section:
echo "Continuing qmail-pop3d"
svc -c /service/qmail-pop3d
12. 将下面内容加入qmailctl脚本的"restart"部分 12. Add the following to qmailctl's "restart" section:
echo "* Restarting qmail-pop3d."
svc -t /service/qmail-pop3d /service/qmail-pop3d/log
5.2.2. Qpopper
如果你需要一个在mbox格式邮箱下工作的的POP后台服务程序, 你可以选用 Qualcomm的 Qpoper. 它的主页在http://www.eudora.com/qpopper_general/. If you need a POP daemon that works with mbox-format mailboxes, you can use Qualcomm's Qpopper. Qpopper is available from http://www.eudora.com/qpopper_general/.
5.2.3. SolidPOP
SolidPOP这个POP3服务器同时支持maildir和mbox格式的邮箱. 可以在 http://solidpop3d.pld.org.pl/ 访问它. The SolidPOP POP3 server supports both maildir and mbox mailboxes. It's available from http://solidpop3d.pld.org.pl/.
5.2.4. Binc IMAP
Andreas Hanssen 编写了 Binc IMAP服务器, 目前还处于 beta(开发) 状态. Binc IMAP被设计为和qmail-pop3d使用相同的认证机制(checkpassword), 所以它很适合于qmail服务器. 和qmail-pop3d一样, 它只支持maildir格式的邮箱. 可以在http://www.bincimap.andreas.hanssen.name/ 访问到它. Andreas Hanssen has written the Binc IMAP server, which is currently in beta (development) mode. Binc IMAP is designed to use the same authentication mechanism (checkpassword) that qmail-pop3d uses, so it's a good fit for qmail servers. Like qmail-pop3d, it supports only Maildir mailboxes. See: http://www.bincimap.andreas.hanssen.name/.
5.2.5. imap-maildir
David R. Harris 整理了有关 University of Washington IMAP 服务器的关于 maildir 格式支持的补丁, 并且存档了安装过程. 参见http://www.davideous.com/imap-maildir/ . David R. Harris has cleaned up the patch that adds maildir support to the University of Washington IMAP server and documented the installation process. See http://www.davideous.com/imap-maildir/.
5.2.6. Courier-IMAP
Sam Varshavchik 编写了一个只支持maildir邮箱的IMAP 服务器. 可以在这里 http://www.inter7.com/courierimap/ 访问. Sam Varshavchik has written an IMAP server that supports maildir mailboxes only. It's available from http://www.inter7.com/courierimap/.
5.3. POP 和 IMAP 客户端 POP and IMAP clients
5.3.1. fetchmail
fetchmail 是一个从POP或者IMAP服务器接收邮件并且再次本地注入的程序. fetchmail从qmail服务器接收邮件是没有问题的, 不过作为qmail的客户端, 要让它良好的工作, 有两个技巧. fetchmail is a program that retrieves mail from a POP or IMAP server and re-injects it locally. fetchmail has no trouble retrieving mail from qmail servers, but there are a couple tricks for making it work well on a qmail client.
这里是一个在qmail系统上为某个用户配置的.fetchmailrc例子: Here's a sample .fetchmailrc for a user on a qmail system:
poll mail.example.net proto pop3 nodns
user dsill with password flubgart is dave here
fetchall forcecr
这个文件指示fetchmail 通过POP3协议连接mail.example.net服务器, 作为用户dsill\登录, 密码flubgart, 接收所有邮件, 然后传送这些邮件到 dave@localhost. forcecr 标志使fetchmail将每个邮件通过SMTP方式注入本地系统前对邮件的每行以回车符结束. qmail要求如此. This instructs fetchmail to connect to mail.example.net via POP3, log in as user dsill, password flubgart, retrieve all messages, and deliver them to dave@localhost. The forcecr causes fetchmail to end each line with a carriage return when injecting the message on the local system via SMTP. qmail requires this.
5.3.2. getmail
getmail 从POP服务器接收邮件然后传送到maildir格式的邮箱. 实际上它是个Python 脚本, 所以你在使用getmail之前需要安装Python解释器. getmail is a program that retrieves mail from a POP server and delivers it to a maildir mailbox. It's actually a Python script, so you may need to install the Python interpreter before you can use getmail
getmail 由 Charles Cazabon 编写, 他在这个位置http://www.qcc.sk.ca/~charlesc/software/getmail-2.0/getmail.html 为getmail维护了一个网页. getmail was written by Charles Cazabon, who maintains a web page for it at http://www.qcc.sk.ca/~charlesc/software/getmail-2.0/getmail.html.
5.4. Multi-RCPT 与 Single RCPT 传送方式的比较 Multi-RCPT vs. Single RCPT delivery
假如你是一个MTA, 你的一个用户发送一封邮件给 hostx.example.com上的三个人. 那么你有以下几种方式可以达成目标. Say you're an MTA, and one of your users sends a message to three people on hostx.example.com. There are several ways you could do this.
- 你可以建立一个连接到hostx主机, 发送邮件的一个拷贝给第一个用户, 发送一个拷贝给第二个用户, 发送一个拷贝给第三个用户, 然后关闭连接. You could open an SMTP connection to hostx, send a copy of the message to the first user, send a copy to the second user, send a copy to the third user, then close the connection.
- 你可以开始三个过程, 每一个都建立一个和hostx的SMTP连接, 给每个用户发送一份邮件的副本, 然后关闭连接. You could start three processes, each of which opens an SMTP connection to hostx, sends a copy of the message to one of the users, then closes the connection.
- 你可以建立一个SMTP连接, 然后发送一个标志着传送给所有三个用户的副本, 然后关闭连接. You could open an SMTP connection to host, send a copy of the message addressed to all three users, then close the connection.
第一个方法明显劣于第三个. 甚至邮件很小的情况下, 整个邮件传送也需要最长的时间. 如果邮件很大, 那么将会使用很长时间并且浪费大量网络带宽. The first method is clearly inferior to the third. Even if the message is tiny, it'll take at least as long. And if the message is large, it'll take a lot longer and use more network bandwidth.
所以, 划掉第一个. So scratch that one.
第二个和第三个方法有点意思. The second and third methods are a little more interesting.
第三个方法仅仅建立一个连接到hostx, 而且只发送一个邮件的副本, 这个方式取得了最有效的带宽利用率. The third method only opens one connection to hostx, and only sends one copy of the message. That makes for efficient use of bandwidth.
第二种方式建立多个连接, 并且传送了邮件的多个副本, 这是非常浪费带宽的, 不过由于SMTP协议的现状, 这个方式可以得到更少的来回往返延迟, 从而比第三中方式更快. 而且比第三种方式更简单, 进而MTA可以被编写使用一个更直接了当的方式来传送邮件. 最后, 由于每个接收者接收到属于他自己的哪一份邮件副本, 这样才有可能让MTA实现VERPs(参见下一节) The second method uses multiple connections and sends multiple copies of the message. That "wastes" bandwidth, but due to the nature of the SMTP protocol, requires fewer round-trip delays, and is faster than the third method. It's also simpler than the third method, so the MTA can be coded in a more straightforward manner. And finally, because each recipient gets their own copy of the message, it's possible for the MTA to implement VERPs (see next section).
qmail 总是使用第二种方式(single RCPT). 而且没有补丁让qmail实现第三种方式(multiple RCPT)的传送-- 因为那将是一个非常大的修补工作. qmail always uses the second method (single RCPT). There are no patches to implement the third method (multiple RCPT)--it would require major work.
虽然有些病态的案例表明第二种方式比第三种方式更慢, 整体上, 系统的简单性和VERP取得的优势比这个更为重要. Although there are pathological cases where it can be slower than multiple RCPT, the simplicity and VERP advantages outweigh that overall.
Single RCPT 传送方式比multiple RCPT方式的确使用了更多的带宽, 不过差别常常是被夸大了的. 绝大多数邮件至多只有两个接收者, 而他们通常是本别两个主机上的用户, 对于这样的情形, multi-RCPT没有任何优势. 甚至情况特殊些, 在一个邮件列表服务器上, 相对来说, multi-RCPT看起来会有很大帮助可是潜在的是非常微小的, 因为SMTP利用的往往只是带宽的很细碎的份额, 在绝大多数连接上, HTTP通常占用了最大的部分. Single RCPT delivery does use more bandwidth than multiple RCPT delivery, but the difference is often exaggerated. Most messages have, at most, a couple recipients, and they're usually on separate hosts, so multi-RCPT delivery buys them nothing. Even on a list server, where multi-RCPT delivery could help, the potential gains are small because SMTP uses only a fraction of the bandwidth over most links--HTTP usually gets the lion's share.
举一个例子, 你的上行带宽的10%用于SMTP, 那么如果应用multi-RCPT, 假设你的SMTP带宽被降低, 比如, 25%, 那么实际上仅仅让你的SMTP需求带宽达到了总带宽的7.5%. For example, if 10% of your uplink's bandwidth goes to SMTP, and your SMTP bandwidth could be reduced by, say, 25%, by using multi-RCPT delivery, that would only drop your SMTP bandwidth to 7.5%.
5.5. 关于 VERP
一旦一个邮件未能被传送, MTA的反应应该是按照信封上的返回路径(envelope return path, ERP)发送一个反弹邮件. 反弹邮件应该包括接收者的地址, 未能发送的原因, 以及故障是暂时的还是永久的信息. 尽管某些MTA做的不是正确的事情, 他们发送反弹邮件给邮件头的From区域标志的地址, 或者反弹邮件干脆不能识别接收者. When a message is undeliverable, the MTA responsiblle is supposed to return a bounce message to the envelope return path (ERP). The bounce message should include the address of the recipient, the reason the message is undeliverable, and whether the problem is temporary or permanent. Some MTA's don't do the right thing, though. They might send the bounce to the address in the From header field, or the bounce might not identify the recipient.
对于大多数用户到用户的邮件, 这种问题没什么大不了. 人们可以按照反弹定时和邮件内容来处理. 可是对于邮件列表, 糟糕的反弹将会严重的多. 订阅者移动, 转发邮件到他们的新地址, 如果新地址发生传送问题, 并且反弹邮件只包含了新地址, 那就无法知道到底是哪个订户的邮件被反弹了. For most user-to-user messages, these problems aren't too bad. One can usually figure things out based on the timing of the bounce or the contents. For mailing lists, the problem of bad bounces is more serious. Subscribers move, forwarding mail to their new address. If the new address starts having delivery problems, it can be impossible to tell which subscriber's mail is bouncing if the bounce message only includes the new address.
Dan Bernstein 为这个问题提出一个解决方案称为VERP(Variable Envelope Return Path). 使用VERP, 发送给每个邮件列表订户的邮件都拥有唯一的返回路径. 这让反弹控制可以控制查找有问题的订阅者. Dan Bernstein came up with a solution to this problem called VERP (Variable Envelope Return Path). Using VERPs, each message sent to each subscriber to a list has a unique return path. This allows a bounce handler to identify the problem subscriber.
举一个例子, 一个典型的非VERP邮件列表拥有的返回地址型如listname-owner@domain. 而对于VERP类型的邮件列表, 返回地址型如listname-owner-subscriber=sdomain@ldomain, 这里订户的地址 subscriber@sdomain被嵌入到列表拥有者"owner"和符号"@"之间了. (订阅者邮件地址的"@"符号被置换成等号"=".) For example, a typical non-VERP'ed mailing list has a return address of the form listname-owner@domain. For a VERP'ed list, the return address would look like listname-owner-subscriber=sdomain@ldomain, where the subscriber's address, subscriber@sdomain, is embedded between the "owner" and the "@". (The "@" in the subscriber's address is replaced with an "=".)
ezmlm邮件列表管理器使用VERP来自动控制反弹. 对于列表暂时的传送问题造成的某些邮件丢失, 这个管理器也提供让订阅者从列表存档文件中单独接收的功能. The ezmlm list manager uses VERPs to automatically handle bounces. It even provides subscribers with temporary delivery problems with a list of the messages they missed so they can retrieve them from the archive.
Russell Nelson 为qmail下的Majordomo写了一个反弹控制器, 不过他没有再继续维护这个软件. 可以在这里http://www.qmail.org/bounceman-0.4.shar 访问到它. Russell Nelson wrote a bounce manager for Majordomo under qmail, but he no longer maintains it. It's available from http://www.qmail.org/bounceman-0.4.shar.
5.6. 故障处理 Troubleshooting
5.6.1. 进程 Processes
一个恰当运行着的, 完整的, 最小化安装的应该拥有下面的四个进程. A properly-running, complete, but minimal qmail installation should always have the following four processes:
- 由用户qmails 运行的 qmail-send qmail-send running as user qmails
- 由用户qmailq运行的qmail-clean qmail-clean running as user qmailq
- 由用户qmailr运行的qmail-rspawn qmail-rspawn running as user qmailr
- 由用户root运行的qmail-lspawn qmail-lspawn running as user root
取决于你使用的何种UNIX, 下面两个命令的一个可能列出这些进程, 而且可能还要多一点: Depending upon your flavor of UNIX, one of the following two commands should list these processes, and possibly a few more:
ps -ef | grep qmail
ps waux | grep qmail
举个例子: For example:
[dave@sparge dave]$ ps waux|grep qmail
dave 2222 0.0 0.8 836 348 p4 S 10:25 0:00 grep qmail
qmaild 351 0.0 1.0 840 400 ? S N 12:43 0:00 /usr/local/bin/tcpserver -v -x /etc/tcp.smtp.cdb -u 49491 -g 31314 0 smtp /var/qmail/bin/qmail-smtpd-
qmaild 2220 0.0 1.0 844 420 ? S N 10:25 0:00 /usr/local/bin/tcpserver -v -x /etc/tcp.smtp.cdb -u 49491 -g 31314 0 smtp /var/qmail/bin/qmail-smtpd-
qmaill 365 0.0 0.8 748 344 ? S N 12:43 0:00 splogger qmail
qmailq 368 0.0 0.7 736 292 ? S N 12:43 0:00 qmail-clean
qmailr 367 0.0 0.6 732 272 ? S N 12:43 0:00 qmail-rspawn
qmails 350 0.0 0.8 776 336 ? S N 12:43 0:00 qmail-send
root 340 0.0 0.6 724 252 ? S N 12:43 0:00 /usr/local/sbin/supervise /var/supervise/qmail-send /var/qmail/rc
root 341 0.0 0.6 724 252 ? S N 12:43 0:00 /usr/local/sbin/supervise /var/supervise/tcpserver-qmail /usr/local/bin/tcpserver -v -x /etc/tcp.smtp
root 366 0.0 0.7 736 276 ? S N 12:43 0:00 qmail-lspawn ./Mailbox
[dave@sparge dave]$
如果你在supervise下运行qmail或qmail-smtpd, 像上面的例子那样, 你应该能看到上面那些进程. 如果你在tcpserver下运行qmail-smtpd, 你将看到一个父tcpserver进程加上每个活动的SMTP访问建立的连接的tcpserver进程. If you run qmail or qmail-smtpd under supervise, as in the example above, you should see those processes as well. And if run qmail-smtpd under tcpserver, you should see a parent tcpserver process plus an additional tcpserver process for each active incoming SMTP connection.
如果你使用splogger (或者 multilog 或者 cyclog) 来控制日志, 你应该还有一个 splogger(或者 multilog 或者 cyclog) 进程由用户qmaill运行着. If you use splogger (or multilog or cyclog) to handle logging, you'll have a splogger (or multilog or cyclog) process or two running as user qmaill.
同时, 如果qmail忙于传送本地和远程邮件, 你将会看到最高上限为 concurrencylocal 个数的qmail-local进程, 或者最高上限为 concurrencyremote 个数的qmail-remote 进程. Also, if qmail is busy delivering messages locally or remotely, you'll see up to concurrencylocal qmail-local processes and up to concurrencyremote qmail-remote processes.
5.6.2. 日志 Logs
5.6.2.1. multilog
multilog, 是daemontools 软件包内的一部分, 功能是将日志记录到指定文件夹内一系列文件上. multilog, which is part of the daemontools package, logs messages to a series of files in a specified directory.
日志文件夹将在multilog命令行上指定, 所以你可以检查你的qmail运行脚本来确定文件夹的位置. The log directory is specified on the multilog command line, so you can find it by examining your qmail startup scripts.
log文件夹内文件数量以及每个log文件的最大长度, 是由multilog的选项决定的. log日志文件名是以文件开始记录时刻的TAI (Temps Atomique International) 时间戳命名的. daemontools里面的另外一个命令 tai64nlocal , 可以转换TAI时间戳为当地人类易读时间戳. The number of files in the log directory, and the maximum size of each file, are determined by multilog options. The log file names are the TAI (Temps Atomique International) timestamps of the time at which the file was started. The tai64nlocal command, also from daemontools, converts TAI timestamps into local, human-readable timestamps.
一个标准的multilog日志条目看起来是下面这样的: A typical multilog log entry looks like:
@4000000038c3eeb104a6ecf4 delivery 153: success: did_1+0+0/
"@4000000038c3eeb104a6ecf4"是TAI时间戳, 为可选部分, 不过推荐在日志条目里面加上这个段, "delivery 153: success: did_1+0+0/" 是日志消息本身. "@4000000038c3eeb104a6ecf4" is the optional, but recommended, TAI timestamp. "delivery 153: success: did_1+0+0/" is the log message itself.
5.6.2.2. splogger
splogger 使用syslog 日志记录系统给消息打时间戳, 然后将消息送往syslog后台服务程序. Syslog的配置文件为 /etc/syslog.conf. 发送给syslog的消息拥有功能和优先级属性. syslog按照定义在/etc/syslog.conf里面的条目过滤消息, 并依据功能和优先级将消息发往以下目标: log日志文件, 远程日志主机, 或者控制台. splogger 默认情况下将记录到mail 功能下面, 所以用grep命令在syslog.conf文件里面查找"mail"可以显示出qmail的日志消息的配置. splogger uses the syslog logging system to timestamp messages and send them to the syslog daemon. Syslog is configured in /etc/syslog.conf. Messages sent to syslog have a facility and priority. Entries in /etc/syslog.conf filter on the facility and priority to direct the messages to the desired log file, remote log host, or the console. splogger logs to the mail facility, by default, so grep'ing the syslog.conf file for "mail" should show the disposition of qmail's log messages.
典型的位置包括: Typical locations include:
- /var/log/syslog
- /var/adm/SYSLOG
- /var/log/maillog
典型的syslog日志条目看起来是这样的: A typical syslog log entry looks like:
Jun 3 11:35:23 sparge qmail: 928424123.963558 delivery 153: success: did_1+0+0/
"Jun 3 11:35:23" 是syslog时间戳 "Jun 3 11:35:23" is the syslog timestamp.
"sparge" 是发送这条消息的系统名子. "sparge" is the name of the system that sent the message.
"qmail:" 是splogger 放置在所有qmail日志条目前的标签. "qmail:" is the tag splogger places on all qmail log entries.
"928424123.963558" 是一个可选的TAI 时间戳 (参看下一节) "928424123.963558" is an optional TAI timestamp (see next section).
"delivery 153: success: did_1+0+0/" 是日志消息本身. "delivery 153: success: did_1+0+0/" is the log message itself.
5.6.2.3. 日志消息 Log messages
下面是一段从本地系统发送一个邮件到远程系统的日志片断: Here's a typical log sequence for a message sent to a remote system from the local system:
1 @4000000038c3eeb027f41c7c new msg 93869
2 @4000000038c3eeb027f6b0a4 info msg 93869: bytes 2343 from <dave@sill.org> qp 18695 uid 49491
3 @4000000038c3eeb02877ee94 starting delivery 2392: msg 93869 to remote lwq@w3.to
4 @4000000038c3eeb0287b55ac status: local 0/10 remote 1/20
5 @4000000038c3eeb104a13804 delivery 2392: success: 209.85.127.177_accepted_message.
/Remote_host_said:_250_CAA01516_Message_accepted_for_delivery/
6 @4000000038c3eeb104a4492c status: local 0/10 remote 0/20
7 @4000000038c3eeb104a6ecf4 end msg 93869
第 1 行指出qmail接收到一条新邮件, 邮件的队列ID是93869. 队列ID是 /var/qmail/queue/mess/NN/ 包含这个邮件的队列文件的 i 节点数字. 队列ID将在这个消息存在于队列中的过程里保持全局唯一. Line 1 indicates that qmail has received a new message, and its queue ID is 93869. The queue ID is the i-node number of the /var/qmail/queue/mess/NN/ file--the queue file that contains the message. The queue ID is guaranteed to be unique as long as the message remains in the queue.
第 2 行表明邮件来自 dave@sill.org, 并且大小为2343字节. Line 2 says that the message is from dave@sill.org and is 2343 bytes.
第 3 行表明qmail-remote开始传送这个邮件到lwq@w3.to, 并且为这个传送指定了ID 2392. Line 3 says qmail-remote is starting to deliver the message to lwq@w3.to, and it's assigning the ID 2392 to the delivery.
第 4 行指出 0 个本地传送和 1 个远程传送处于等待状态. Line 4 says 0 local deliveries and 1 remote delivery are pending.
第 5 行显示出 ID 2392 这个传送已经成功完成, 并且返回远程主机的回应, 这个回应里面常常包含了远程邮件管理员对于跟踪这个传送的有用信息. 在我们这个例子里面, "CAA01516"是远程系统的传送ID. Line 5 says delivery 2392 is complete and successful, and it returns the remote server's response, which often contains information the remote mail administrator would find helpful in tracking a delivery. In this case, the "CAA01516" is the remote system's delivery ID.
第 6 行指出 0 个本地传送和 0个远程传送处于等待状态. 也就是传送已经完成了. Line 6 says 0 local deliveries and 0 remote deliveries are pending, i.e., the delivery is complete.
第 7 行指出这个消息已经被传送完毕并且被移出队列. 这个时候, 队列ID 93869, 已经可以重用于其他传送ID了. Line 7 says that the message has been delivered completely and removed from the queue. At this point, the queue ID, 93869, is reusable for another delivery.
5.7. 大型服务器 Big Servers
同时参考 qmail-ldap See also qmail-ldap.
5.7.1. 可伸缩的并行运算 Scalable parallelism
使用快速NFS网络文件服务器储存用户文件夹. 在文件服务器上建立多个平等优先级SMTP服务器传送maildir格式邮箱. Use a fast NFS network file server to store user directories. Set up multiple equal-preference SMTP servers delivering to maildir mailboxes on the file server.
5.8. 从 Sendmail 转移到 qmail Migrating from Sendmail to qmail
查看Dan Bernstein 的 Sendmail->qmail 网页 http://cr.yp.to/qmail/sendmail.html. Check Dan Bernstein's Sendmail->qmail page at http://cr.yp.to/qmail/sendmail.html.
5.9. 邮件列表管理器 Mailing List Managers
邮件列表管理器(MLM)是帮助邮件列表所有者运行邮件列表的的程序. 它的功能由两部分组成: 管理订阅者列表, 还有就是控制对订阅者的邮件再发. Mailing list managers (MLM's) are systems that help list owners run mailing lists. Their duties fall into two main divisions: managing the lists of subscribers, and controlling the resending of messages to the subscribers.
大多数(全部?)UNIX邮件列表管理器都可以和qmail 合作运行. Most (all?) UNIX mailing list managers can be made to work with qmail.
5.9.1. ezmlm
ezmlm 是qmail的作者Dan Bernstein为qmail编写的邮件列表管理器. 它依赖于qmail服务器的几个特点工作, 最显著的, 就是它使用VERPs 来可靠的处理反弹邮件. ezmlm 在众多邮件列表管理器(MLM)中显得有点独特, 它不是处理传送到中央MLM地址的命令, 而是将命令附加在列表名字后面. 例如, 发送邮件到"foo-subscribe@list.example.net" 来订阅 "foo@list.example.net" 的邮件列表, . ezmlm was written by Dan Bernstein, the author of qmail. It was written for use with qmail, and relies on several features of qmail. Most notably, it uses VERPs to reliably process bounce messages. ezmlm is somewhat unique among MLM's in that it doesn't process commands sent to a central MLM address: it appends the command to the name of the list. E.g., to subscribe to the "foo@list.example.net" list, one sends a message to "foo-subscribe@list.example.net".
关于ezmlm的更多信息, 参见 http://www.ezmlm.org/, 这是ezmlm的非正式web站点. ezmlm-idx的正式站点, 介绍了这个非常棒的add-on插件ezmlm-idx, 它包括了很多有用的特色. For more information about ezmlm, see http://www.ezmlm.org/, the unofficial ezmlm web site, and the official home of ezmlm-idx, a very nice add-on that includes many useful features.
5.9.2. Majordomo
Majordomo 是最受欢迎的UNIX MLM之一. 只要作很少的简单修改就可以使它和qmail很好的合作了. Russ Allbery曾经写了一个关于qmail和Majordomo的FAQ, 可以在这个位置访问http://www.eyrie.org/~eagle/faqs/mjqmail.html .Majordomo is one of the most popular UNIX MLMs. It works fine with qmail provided a few simple changes are made. Russ Allbery has written a FAQ about qmail/Majordomo available from http://www.eyrie.org/~eagle/faqs/mjqmail.html.
5.10. 补丁 Patches
qmail拥有各种各样的源代码补丁. 为了安装补丁, 下载补丁并且进入qmail源代码目录树, 使用patch 命令施加补丁. Various source code patches are available for qmail. To install a patch, download it, cd to the qmail source tree, and apply it using the patch command.
cd /usr/local/src/qmail/qmail-1.03
patch -p0 </tmp/patchfile
注意: 参考 patch 的 man 帮助页取得更多信息. 这仅仅是个例子. 你可能需要使用最新版本的GNU patch 来施加补丁, 参见http://www.gnu.org/software/patch/patch.html. Note: See the patch man page for more information. This is just an example. Also, you might need to use a current version of GNU patch to successfully apply some patches. See http://www.gnu.org/software/patch/patch.html.
Stop qmail by killing qmail-send or, if you installed the qmailctl script in the Installation section, do:
qmailctl stop
Then rebuild and install the new binaries:
make setup check
And restart qmail:
qmailctl start
Finally, test qmail--especially the part you patched.
注意: 虽然http://www.qmail.org/列出了qmail的大量补丁, 但是他们中的任何一个都没有得到qmail作者的认可. 这些补丁可能引入qmail原本没有的安全, 可靠性, 效率以及功能性问题. 绝大多数qmail安装只是要求某些推荐的补丁. 请不要安装任何你不是明确需要的补丁. Note: Although http://www.qmail.org/ lists many patches for qmail, none of the them have been approved by the author of qmail. They may introduce security, reliability, efficiency, or functionality problems not present in qmail. Most qmail installations only require the some of the Recommended patches. You should not install any patches that you don't clearly require.
5.10.1. 推荐的补丁 Recommended Patches
qmail.org 有一个"Recommended Patches"小节 http://qmail.org/top.html#patches . 这些补丁用于几个已知的qmail的bug. qmail.org has a "Recommended Patches" section: http://qmail.org/top.html#patches. These patches address the few known bugs in qmail.
5.10.1.1. errno.h patch
这个补丁修复 errno.h 头文件缺失问题. 参考 http://news.gmane.org/article.php?id=13960&group=gmane.mail.qmail.general 查看这个补丁的细节解释. This patch fixes a problem with missing errno.h inclusions. See http://news.gmane.org/article.php?id=13960&group=gmane.mail.qmail.general for a detailed explanation and the patch itself.
5.10.1.2. qmail-local TAB patch
这个补丁修补处理.qmail文件内TAB字符开头问题的小bug. 参见http://www.ornl.gov/its/archives/mailing-lists/qmail/2000/10/msg00696.htmlThis patch fixes a minor bug in the parsing of .qmail files that start with TAB characters. http://www.ornl.gov/its/archives/mailing-lists/qmail/2000/10/msg00696.html
5.10.1.3. IP 0.0.0.0 patch
这个补丁将使qmail把 0.0.0.0 这个IP地址作为本地主机处理. http://www.suspectclass.com/~sgifford/qmail/qmail-0.0.0.0.patch .This patch causes the IP address 0.0.0.0 to be recognized as local. http://www.suspectclass.com/~sgifford/qmail/qmail-0.0.0.0.patch
5.10.2. DNS
在历史上, DNS 的回答被限制在512字节以内. 一些大型站点反馈的 MX 记录要长于这个限度. 这样qmail和其他很多程序都会遇到这个DNS返回查询记录过长的问题. 有三种方式来修补qmail. Historically, DNS responses have been limited to 512 bytes. Some large sites have started returning MX responses longer than that. qmail and many other programs have a problem with Domain Name Server (DNS) queries that return very large results. There are three ways to fix this in qmail.
5.10.2.1. 从 djbdns 运行 dnscache Run dnscache from djbdns
dnscache 顾名思义, 是一个DNS的缓存服务器. 它知道如何掌握很长的DNS反馈记录并且通常可以为所有服务提高DNS查询性能. 由于它不用给qmail打补丁, 这是目前为止最好的解决方式. 参见 相关软件包 下的 djbdns 节取得更多信息. dnscache is, as the name implies, a caching DNS server. It knows how to handle large DNS responses and generally improves DNS lookup performance for all services that use DNS. Because it doesn't require patching qmail, this is by far the best solution. See the djbdns section under Related Packages for more information.
5.10.2.2. 提高包缓存长度到65536 Bump the packet buffer size up to 65536
如果DNS反馈设置有切断位, 在近来的BIND解析库下工作时, 解析器编码为自动进行TCP查询. 虽然取决于你的系统如何管理系统内存页的情况下, 内存的最大浪费成为潜在存在的可能性, 不过这却是最简单的修补. 作这个修补, 只需要替换 dns.c 文件内的PACKETSZ为 65536, 然后重新编译安装qmail就行了. Works with recent BIND resolver libraries, which will automatically do a TCP query within the library code if the reply comes back with the truncation bit set. This is the simplest fix, though it's also potentially the most wasteful of memory, depending on how your system handles paging. To do this, just replace PACKETSZ with 65536 in dns.c and rebuild qmail.
5.10.2.3. Christopher K. Davis' 的补丁, http://www.ckdhr.com/ckd/qmail-103.patch Christopher K. Davis' patch, http://www.ckdhr.com/ckd/qmail-103.patch
这是一个 Chuck Foster的补丁的改写版, 这个补丁可以在任何解析库下工作, 无论多旧, 它使用一个保护字节来避免"置于缓冲中的字节数"这个库bug. 它仅仅重分配一次缓存为65536字节, 而不是分配正好需要的大小, 所以它可能比Chuck的补丁内存效率低一些(虽然如此, 像Chuck的这个补丁仅在反馈长度大于PACKETSZ--默认为512字节--情况下重分配缓存) 重分配之后, 它强制一个TCP查询, 而不是要求解析库来作查询(尽管在qmail和名字服务器同在一个机器或者同在一个局域网络里面的情况下, 这种查询不算什么负担, 这样作还是避免了在qmail和名字服务器之间额外的往返). This is an adaptation of a patch by Chuck Foster's which should work with any resolver library, no matter how old, and uses a guard byte to avoid the "number of bytes placed in the buffer" library bug. It reallocates only once, to 65536, rather than just to the size needed, so it can be less memory-efficient than Chuck's patch (though, like his patch, it only reallocates if the response is larger than PACKETSZ, which defaults to 512 bytes). After reallocating, it forces a TCP query, rather than requiring the resolver library to do so (avoiding an extra round-trip between qmail and the name server, though if they're on the same machine or local network this is not a big worry).
5.10.3. qmail-ldap
这个补丁, 由 Andre Oppermann等人编写, 实现了qmail的Lightweight Directory Access Protocol (LDAP)支持. LDAP像一个网络电话簿. 使用 qmail-ldap, 它可以使一个POP服务器支持数以千计的众多用户. 参见http://www.nrg4u.com/. This patch, by Andre Oppermann, et al, implements Lightweight Directory Access Protocol (LDAP) support in qmail. LDAP is like a network phone book. Using qmail-ldap, it should be possible for a POP server to serve many thousands of users. See http://www.nrg4u.com/.
5.11. QMTP
QMTP 是 Quick Mail Transfer Protocol 的缩写, 由Dan Bernstein设计的用来替代SMTP的协议. 这个协议定义在 http://cr.yp.to/proto/qmtp.txt . QMTP比SMTP更简单, 更快速以及兼容SMTP. qmail包含一个QMTP服务器, qmail-qmtp, 它运行起来非常类似于 qmail-smtp. QMTP通常使用端口209. QMTP is the Quick Mail Transfer Protocol, an SMTP replacement protocol designed by Dan Bernstein. The protocol is defined at http://cr.yp.to/proto/qmtp.txt. QMTP is similar to SMTP, but is simpler, faster, and incompatible with SMTP. qmail includes a QMTP server, qmail-qmtp, which is run very much like qmail-smtp. QMTP usually uses port 209.
qmail并不包括QMTP的客户端, 不过 serialmail 软件包包括一个客户端. maildirqmtp 命令接收maildir格式邮箱并以QMTP协议传送邮箱内的邮件到指定的QMTP服务器. qmail doesn't include a QMTP client, but the serialmail package does. maildirqmtp takes a maildir mailbox and delivers the messages it contains to designated QMTP server via QMTP.
QMTP不是一个drop-in方式的SMTP的替代品, 在因特网上的使用也不是很普遍. QMTP is not a drop-in replacement for SMTP, and is not yet in widespread use across the Internet.
Russ Nelson 为qmail-remote写了一个支持QMTP的补丁. 可以在 这里 http://www.qmail.org/qmail-1.03-qmtpc.patch 取得这个补丁. 他也编写了一个tarball安装方式的程序, 可以展开到 /service 目录下进行QMTP服务. 可以在这里http://www.qmail.org/qmtpd-service.tar.gz 取得这个tarball包. Russ Nelson has a patch for qmail-remote that supports QMTP. It's available from http://www.qmail.org/qmail-1.03-qmtpc.patch. He also has a tarball that can be extracted in /service to enable a QMTP service. It's available from http://www.qmail.org/qmtpd-service.tar.gz.
附录 A. 致谢 A. Acknowledgments
首先, 感谢Dan Bernstein 编写了这样一个强大而优雅的系统. 经过五年的使用, qmail依然给我深刻的印象. First, thanks to Dan Bernstein for designing and writing such a powerful and elegant system. After five years of use, qmail still impresses me.
我想感谢那些qmail邮件列表的成员. 作为最有帮助的, 最有耐心的, 以及最知识渊博和有趣的撰稿人之一, Russell Nelson 应该被特别提及, 他对于qmail 社区的贡献仅次于DJB. I'd also like to thank the members of the qmail mailing list. Russell Nelson deserves special mention as one of the most helpful, patient, knowledgeable, and funny contributors. His contributions to the qmail community are second only to DJB's.
感谢每一个评论或者对这个文档作出贡献的人, 他们包括: Thanks also to everyone who reviewed or contributed to this document, including:
- Vince Vielhaber
- Chris Green
- Christopher K. Davis
- Scott Schwartz
- Fred Lindberg
- Russell P. Sutherland
- Alex Miller
- Tim Hunter
- Frank D. Cringle
- Mahlon Smith
- Rogerio Brito
- Tony Hansmann
- Matthias Andree
- Tillman Hodgson
- Stefan Witzel
- Scott Gifford
- 有太多可被提及的其他的人了....too many others to mention...
特殊感谢Henning Brauer捐赠了lifewithqmail.org 域名, 并维护服务器! Special thanks to Henning Brauer for donating the lifewithqmail.org domain and hosting it!
Life with qmail 使用Simple Document Format (SDF) 编写, 一个非常酷的Perl 编写的标记语言产生HTML, 纯文本, PostScript, POD以及其他格式. 这个工具使工作变得特别容易, 参见http://search.cpan.org/author/IANC/sdf-2.001/ 查找关于这个工具的更多信息. Life with qmail was written using Simple Document Format (SDF), a very cool Perl-based markup language that generates HTML, plain text, PostScript, POD, and other formats. It made the job much easier. See http://search.cpan.org/author/IANC/sdf-2.001/ for more information.
附录 B. 相关软件包介绍 B. Related Packages
B.1. dot-forward
Sendmail 使用.forward(发音 dot forward)文件来允许用户控制传输他们收到的邮件. qmail使用一种类似的机制: .qmail文件. dot-forward软件包给予qmail使用.forward文件的能力. 使用Sendmail和其他使用.forward控制文件的MTA可以利用dot-forward程序避免使用.forward文件的等效物.qmail文件而不是使用.forward文件, 或者简单地对于用户来说, 在使用qmail平台时尽量少的改变用户原来使用Sendmail时看得到的东西., 比如直接使用. forward文件的习惯. Sendmail uses .forward files, pronounced dot forward, to allow users to control the delivery of messages they receive. qmail uses a similar mechanism: .qmail files. The dot-forward package gives qmail the ability to use .forward files. Systems running Sendmail or any other MTA that uses .forward files might want to consider using dot-forward to avoid having to convert existing .forward files to their .qmail equivalents--or simply to make the transition to qmail less visible to their users.
dot-forward程序是一个小软件包, 很容易安装配置. 源代码可以在ftp://cr.yp.to/software/dot-forward-0.71.tar.gz这里取得. dot-forward is a small package: easy to install and configure. The source is available from ftp://cr.yp.to/software/dot-forward-0.71.tar.gz.
dot-forward 由Dan Bernstein编写, 他为这个软件维护了一个web页面http://cr.yp.to/dot-forward.html . dot-forward was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/dot-forward.html.
B.2. fastforward
fastforward是另一个Sendmail兼容插件. Sendmail使用保存在一个单一文件内的中心别名数据库, 通常是 /etc/aliases. qmail使用/var/qmail/alias下的一系列文件, 一个别名一个文件. 如果你要从Sendmail迁移到qmail, dot-qmail文件还不想转换Sendmail格式的的别名文件, 那么fastforward赋予qmail按照原样使用Sendmail别名文件的能力. fastforward is another Sendmail compatibility add-on. Sendmail uses a central alias database kept in a single file, usually /etc/aliases. qmail uses a series of dot-qmail files in /var/qmail/alias, one file per alias. If you're migrating to qmail, and you've got a Sendmail-format aliases file you don't want to convert, fastforward gives qmail the ability to use the aliases file as-is.
源代码可以在 ftp://cr.yp.to/software/fastforward-0.51.tar.gz 这里取得. The source is available from ftp://cr.yp.to/software/fastforward-0.51.tar.gz.
fastforward 由Dan Bernstein 编写, 他在 http://cr.yp.to/fastforward.html 这里维护了一个web页面. fastforward was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/fastforward.html.
B.3. ucspi-tcp
qmail的SMTP服务器并不是按照一个独立的后台服务程序运行的, 必须依靠例如 inetd, xinetd 或者 tcpserver 这些助手程序运行. 当这些助手程序接受一个到达25端口, SMTP端口, 的TCP连接之后, 将执行一个qmail-smtpd的副本. qmail's SMTP server doesn't run as a stand alone daemon. A helper program such as inetd, xinetd, or tcpserver runs as a daemon. When it receives a TCP connection to port 25, the SMTP port, it executes a copy of qmail-smtpd.
inetd 是标准网络服务器"super-server". 可以通过配置/etc/inetd.conf 来运行qmail-smtpd, 不过推荐的工具是tcpserver, 它是ucspi-tcp软件包的一部分. ucspi-tcp是UNIX Client-Server Program Interface for TCP的缩写, 发音是 ooks-pie tee see pee. Inetd is the standard network server "super-server". It can be configured through /etc/inetd.conf to run qmail-smtpd, but the recommended tool is tcpserver, which is part of the ucspi-tcp package. ucspi-tcp is an acronym for UNIX Client-Server Program Interface for TCP, and it's pronounced ooks-pie tee see pee.
tcpserver 优于 inetd的几条原因: tcpserver is preferred over inetd because:
- tcpserver 允许限制并行访问服务的数量. inetd使用连接率限制机制在"太忙"情况下阻断服务. tcpserver allows one to limit the number of simultaneous connections to a service. Inetd has a connection-rate limiting mechanism that temporarily disables services that are "too" busy.
- tcpserver 可以被配置为拒绝某些主机连接或者认可并标志本地主机, 使qmail-smtpd 可以分别对待. tcpserver can be configured to deny access to certain hosts or to recognize local hosts and flag them so qmail-smtpd can treat them differently.
- tcpserver 是唯一的qmail 作者认可的服务器. tcpserver is the only server supported by the author of qmail.
源代码可以在这里ftp://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz取得. The source is available from ftp://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz.
Gerrit Pape 为ucspi-tcp作为 man 帮助页分发的文档可以在这里http://smarden.org/pape/djb/ 访问到. Gerrit Pape distributes the documentation for ucspi-tcp as man pages from http://smarden.org/pape/djb/.
ucspi-tcp由Dan Bernstein编写, 他在这里http://cr.yp.to/ucspi-tcp.html维护了一个web页. ucspi-tcp was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/ucspi-tcp.html.
B.4. daemontools
daemontools软件包包含了一系列控制和监视服务的实用工具. 高度推荐而不强制使用, 特别是对于繁忙的系统. 它包括: The daemontools package contains a set of utilities for controlling and monitoring services. It's not mandatory, but it's highly recommended, especially for busy systems. It includes:
- superivse, 监视服务并在服务停止后重新启动之. supervise, which monitors a service and restarts it if it dies.
- svc, 和supervise会话并且允许停止, 暂停, 或者重启动服务器. svc, which talks to supervise and allows one to stop, pause, or restart the service.
- multilog, 维护服务的日志, 可以自动回转记录以保持低于配置大小. multilog, which maintains a log for a service, automatically rotating it to keep it under the configured size.
- seruidgid, 使用普通用户的UID和GID为超级用户运行程序. setuidgid, which runs programs for the superuser with a normal user's UID and GID.
daemontools的源码可以在这里http://cr.yp.to/daemontools/daemontools-0.76.tar.gz取得. The source for daemontools is available from: http://cr.yp.to/daemontools/daemontools-0.76.tar.gz.
Gerrit Pape 为daemontools作为 man 帮助页分发的文档可以在这里http://smarden.org/pape/djb/访问到. Gerrit Pape distributes the documentation for daemontools as man pages from http://smarden.org/pape/djb/.
daemontools 由Dan Bernstein编写, 他在这里http://cr.yp.to/daemontools.html 维护了一个web页面. daemontools was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/daemontools.html.
B.5. qmailanalog
qmailanalog处理qmail的日志文件并且生成一系列的报告. 报告指示出系统正在工作的类型和工作量. 如果你需要有多少邮件被发送和接收的统计, 以及他们有多大, 他们被处理的有多快, qmailanalog都能显示出来. qmailanalog processes qmail's log file and produces a series of reports that tell one how much and what kind of work the system is doing. If you need statistics about how many messages are being sent or received, how big they are, and how quickly they're being processed, qmailanalog is what you need.
作为一个意外收获, matchup 程序合并qmail 的每个邮件投递的多个日志行为一行 -- 有点类似于Sendmail的日志. As a bonus, the matchup program combines qmail's multiple log lines per delivery into one--not unlike the familiar Sendmail logs.
qmailanalog的源代码可以在这里http://cr.yp.to/software/qmailanalog-0.70.tar.gz取得. The source for qmailanalog is available from http://cr.yp.to/software/qmailanalog-0.70.tar.gz.
qmailanalog 由Dan Bernstein编写, 他在这里http://cr.yp.to/qmailanalog.html维护了一个web页面. qmailanalog was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/qmailanalog.html.
注意: qmailanalog 依赖于由accustamp 使用的小数秒格式的日志条目时间戳. 为了使用它和multilog生成的TAI64N格式的日志, 你必须将他们转换成旧格式. 一个完成这个转换工作的程序可以在这里http://www.qmail.org/tai64nfrac取得. Note: qmailanalog relies on log entry timestamps in the fractional second format used by accustamp. In order to use it with logs generated by multilog, which are in TAI64N format, you'll need to translate them into the old format. One program to do that is available from http://www.qmail.org/tai64nfrac.
B.6. rblsmtpd
如果你从未被垃圾邮件骚扰, 可以说你太幸运了. 绝大多数的电子邮件用户都太熟悉Unsolicited Bulk E-mail (UBE)了, UBE也被称为"spam". 绝大多数垃圾邮件都是色情站点, 邮件锁链和其他诡计的广告. 回到过去的的旧时光, 直到1998年左右, 绝大多数因特网上的MTA都是开放转信的, 也就是说, 他们将会接收任何人给人和人的邮件, 甚至没有发信人也没有本地收信人的邮件. 垃圾邮件发送者利用这些开放转信服务, 尽可能找到他们能找的服务器传送他们的垃圾邮件. 这样就隐藏了他们的踪迹, 栽赃给那些"无罪的"开放转信站点, (通过浪费开放转信站点的资源) 为垃圾邮件制造者节省了大量的CPU和带宽. If you've never been spammed, consider yourself very lucky. Most e-mail users are all too familiar with Unsolicited Bulk E-mail (UBE), aka "spam". Most of it is advertisements for sex sites, chain letters, and other scams. Back in the days of old, up until around 1998 or so, most MTA's on the Internet were open relays, i.e., they would accept mail from anyone for anyone, even if neither sender nor recipient was local. Spammers use open relays, if they can find any, to deliver their spam. It covers their tracks, redirects the backlash toward the "innocent" relay site, and saves them lots of CPU time and network bandwidth.
从那个时期开始, 这样的开放转信的站点被认为是非常糟糕的, 几个反垃圾邮件义务组织创造了一个机制来识别开放转信和其他垃圾邮件的普通来源, 这样他们就能够避免来自垃圾邮件商的SMTP连接. Such open relays are considered very bad form these days, and several anti-spam vigilante groups have created a mechanism for identifying open relays and other common sources of spam so they can avoid accepting SMTP connections from them.
rblsmtpd 是一个 RBL SMTP后台服务程序. 它位于tcpserver和qmail-smtpd之间, 并且拒绝系统认定的那些列表里面系统的连接. rblsmtpd is an RBL SMTP Daemon. It sits between tcpserver and qmail-smtpd and rejects connections from systems identified on one of these lists.
举一个例子, 在tcpserver下运行rblsmtpd, 试试下面这样的写法: For example, to run rblsmtpd under tcpserver, try something like:
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec /usr/local/bin/softlimit -m 2000000 \
/usr/local/bin/tcpserver -v -R -H -l 0 -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /usr/local/bin/rblsmtpd\
-r relays.ordb.org /var/qmail/bin/qmail-smtpd 2>&1
rblsmtpd 以前是作为一个分立的软件包, 现在被捆绑在ucspi-tcp 里面. rblsmtpd was previously available as a separate utility, but is now bundled with ucspi-tcp.
rblsmtpd 由Dan Bernstein 编写, 他在这里http://cr.yp.to/ucspi-tcp/rblsmtpd.html 维护了一个web页面. rblsmtpd was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/ucspi-tcp/rblsmtpd.html.
B.7. serialmail
qmail 是为全部时间高速连接设计的. serialmail 一个工具集让qmail更好的适用于断断续续的, 低速的连接. 在这样的系统上使用serialmail, qmail被配置为传送所有远程邮件到一个单独的maildir文件夹. 一旦网络连通, serialmail的maildirsmtp 命令将用来上传这个maildir到ISP的邮件网络中心. 如果ISP支持QMTP(参看 高级话题 下的 QMTP), maildirqmtp也可以被使用. qmail was designed for systems with full time, high speed connectivity. serialmail is a set of tools that make qmail better suited to intermittent, low speed connectivity. With serialmail on such a system, qmail is configured to deliver all remote mail to a single maildir. The serialmail maildirsmtp command is used to upload the maildir to the ISP's mail hub when the connection is brought up. If the ISP supports QMTP (see QMTP under Advanced Topics), maildirqmtp can also be used.
serialmail 可以被用于ISP方面, 用来实现 AutoTURN, 这是一个 由客户端发起的SMTP 连接, 导致服务器开始反向连接到客户端 , 然后发送服务器端的邮件队列给客户端的过程. 这个和ETRN SMTP机制很相似. serialmail can be used on the ISP side of the connection to implement AutoTURN: an SMTP connection by a client causes the server to initiate a connection back to the client for sending messages queued on the server for the client. This is similar to the ETRN SMTP function.
serialmail的源代码可以在这里http://cr.yp.to/software/serialmail-0.75.tar.gz 得到. The source for serialmail is available from http://cr.yp.to/software/serialmail-0.75.tar.gz.
serialmail 由Dan Bernstein编写, 他在这里http://cr.yp.to/serialmail.html维护了一个web页面. serialmail was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/serialmail.html.
B.8. mess822
mess822 是一个处理 RFC822兼容邮件的库和一系列应用程序. 这些程序包括: mess822 is a library and set of applications for parsing RFC 822 compliant mail messages. The applications include:
- ofmipd: 一个,从客户端接收邮件并基于数据库记录改写From邮件头部分的后台服务程序. ofmipd: a daemon that accepts messages from clients and rewrites From fields based on a database.
- new-inject: 一个qmail-inject的替代程序, 支持用户控制的主机名改写. new-inject: a qmail-inject replacement that supports user-controlled hostname rewriting.
- iftocc: 一个.qmail应用程序, 用来检查是否邮件被发送到指定地址. iftocc: a .qmail utility for checking whether a message was sent to a specific address.
- 822header, 822field, 822date, 和 822received: 从邮件中摘录信息. 822header, 822field, 822date, and 822received: extract information from a message.
- 822print: 优美的打印邮件. 822print: pretty-prints a message.
mess822的元代买可以在这里 http://cr.yp.to/software/mess822-0.58.tar.gz取得. The source for mess822 is available from http://cr.yp.to/software/mess822-0.58.tar.gz.
mess822 由Dan Bernstein编写, 他在这里http://cr.yp.to/mess822.html维护了一个web页面. mess822 was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/mess822.html.
B.9. ezmlm
ezmlm 是一个为qmail设计的高效, 易用的邮件列表管理器(MLM). 如果你熟悉 LISTSERV 或者 Majordomo, 你会知道邮件列表管理器能作什么. 更多在qmail下的关于邮件列表的信息可以在高级话题 下面的 邮件列表管理器 找到. ezmlm is a high performance, easy-to-use mailing list manager (MLM) for qmail. If you're familiar with LISTSERV or Majordomo, you know what a mailing list manager does. For more information about mailing lists under qmail see Mailing List Managers under Advanced Topics.
ezmlm的源代码可以在http://cr.yp.to/software/ezmlm-0.53.tar.gz这里取得. The source for ezmlm is available from http://cr.yp.to/software/ezmlm-0.53.tar.gz.
ezmlm 由 Dan Bernstein编写, 他在这里http://cr.yp.to/ezmlm.html维护着一个web页面. ezmlm was written by Dan Bernstein, who maintains a web page for it at http://cr.yp.to/ezmlm.html.
Fred Lindberg 和 Fred B. Ringel 为ezmlm开发了一个扩展, 叫做ezmlm-idx, 后者增加了大量的有用特色, 我高度推荐使用它. 可以在 http://www.ezmlm.org/ 这里访问 ezmlm-idx. Fred Lindberg and Fred B. Ringel have developed an extension to ezmlm called ezmlm-idx. It adds lots of useful features and is highly recommended. It's available from http://www.ezmlm.org/.
B.10. safecat
safecat 可靠的将文件写入maildir 邮箱中. 在使用procmail 处方时候它特别用来帮助归档邮件.举一个例子, 下面的处方将所有Maildir中的邮件存档. safecat reliably writes a file into a maildir mailbox. It is particularly useful for filing messages in procmail recipes. For example, the following recipe files all messages in Maildir:
:0w
|safecat Maildir/tmp Maildir/new
safecat 由 Len Budney 编写, 他在这里http://www.pobox.com/~lbudney/linux/software/safecat.html为safecat 维护了一个web页面. safecat was written by Len Budney, who maintains a web page for it at http://www.pobox.com/~lbudney/linux/software/safecat.html.
B.11. djbdns
djbdns 是qmail作者编写的DNS服务器. 它包括 tinydns, 一个DNS内容服务器, 和 dnscache, 一个 DNS 缓冲服务器. djbdns is a DNS server written by the author of qmail. It includes tinydns, a DNS content server, and dnscache, a caching DNS server.
djbdns的正式页面在 http://cr.yp.to/djbdns.html. The official web page for djbdns is http://cr.yp.to/djbdns.html.
B.12. maildrop
maildrop是一个和procmail类似的邮件过滤器. maildrop is a mail filter similar to procmail.
maildrop 由 Sam Varshavchik 编写, 他在这里http://www.flounder.net/~mrsam/maildrop为maildrop维护了一个web页面. maildrop was written by Sam Varshavchik, who maintains a web page for it at http://www.flounder.net/~mrsam/maildrop.
B.13. syncdir
syncdir 是一个小型使 link() 系统调用同步的库. 在一个不能同步执行 link() 的文件系统上运行qmail队列时, syncdir是必要的. 例如 Linus的 ext2fs, Reiserfs, SGI的 XFS以及BSD的使用softupdates的FFS系统. syncdir is small library that makes the link() system call synchronous. This is necessary when using qmail with the queue on a filesystem that doesn't perform link() synchronously, such as Linus's ext2fs, Reiserfs, SGI's XFS, and BSD FFS with softupdates.
syncdir 由 Bruce Guenter编写, 可以在这个web页面http://untroubled.org/syncdir/访问. 安装指导在这个位置http://www.ornl.gov/its/archives/mailing-lists/qmail/2001/12/msg00949.html. syncdir was written br Bruce Guenter and is available from http://untroubled.org/syncdir/. Installation instructions are available from http://www.ornl.gov/its/archives/mailing-lists/qmail/2001/12/msg00949.html.
附录 C. 因特网邮件工作原理 C. How Internet Mail Works
C.1. 邮件如何从A点到达B点 How a message gets from point A to point B
当一个主机上的用户想要发送一个邮件给另一个主机上的用户时, 许多事情发生了, 这个场景后面的东西很多是不必要知道的那么确切的. When a user on one host sends a message to a user on a another host, many things happen behind the scenes that you may not be aware of.
假设一个用户 Alice, alice@alpha.example.com 想要发送一个邮件给 Bob, bob@beta.example.com, 下面是发送接收过程: Let's say Alice, alice@alpha.example.com, wants to send a message to Bob, bob@beta.example.com. Here's what happens:
1. Alice 用她的邮件用户代理(MUA)编写邮件, 比如使用 mutt 或者 pine. 她在 To 这一栏指定接收者, Subject 这一栏填写邮件主题, 加上邮件本身的文本部分. 整个邮件看起来是下面这样的: 1. Alice composes the message with her mail user agent (MUA), something like mutt or pine. She specifies the recipient in a To field, the subject of the message in a Subject field, and the text of the message itself. It looks something like:
To: bob@beta
Subject: lunch
How about pizza?
2. 当她觉得这封邮件已经满意之后, 她指派 MUA 发送邮件. 2. When she's satisfied with the message, she tells the MUA to send it.
3. 这时候, MUA 会加上附加的邮件头部分, 比如日期 Date 和邮件ID(Message-Id) 并且修改Alice输入的值(例如, 将 bob@beta 替换为"Bob <bob@beta.example.com>") 下一步, MUA 将邮件注入邮件系统. 有两种方式进行注入: MUA 运行一个由邮件系统提供的为注入邮件为目的的程序; 或者使用SMTP协议和本地或者远程邮件服务器建立连接, 举个例子, 我们假定 MUA 使用本地注入程序将邮件传送给 MTA, 对于不同的MTA, 注入细节都是不同的, 不过对于UNIX系统, 使用sendmail 程序注入已经成了事实上的标准. 使用这种方式, MUA 可以将邮件头和邮件主体放置在一个文件内, 由空行分隔, 然后传递这个文件到 sendmail 程序. 3. At this point, the MUA can add additional header fields like Date and Message-Id and modify the values Alice entered (e.g., replace bob@beta with "Bob <bob@beta.example.com>". Next, the MUA injects the message into the mail system. There are two ways to this: it can run a program provided by the mail system for the purpose of injecting messages, or it can open a connection to the Simple Mail Transfer Protocol (SMTP) port on either the local system or a remote mail server. For this example, we'll assume the MUA uses a local injection program to pass messages to the MTA. The details of the injection process vary by MTA, but on UNIX systems the sendmail method is a de facto standard. With this method, the MUA can put the header and body in a file, separated by a blank line, and pass the file to the sendmail program.
4. 如果注入成功--邮件句法正确, 并且 sendmail 调用适当--那么现在邮件已经在 MTA 的职责内了. 不同的 MTA 细节是完全不同的, 通常MTA首先检查邮件头决定邮件将发往何处. 然后建立一个到主机beta的SMTP连接, 转发邮件给 beta 系统上的MTA. SMTP对话要求邮件被分成两部分发送: 信封, 这个部分确定了接收者的地址(bob@beta.example.com)和返回地址(alice@alpha.example.com), 以及邮件本身, 包括邮件头和邮件主体. 4. If the injection succeeds--the message was syntactically correct and sendmail was invoked properly--the message is now the MTA's responsibility. Details vary greatly by MTA, but generally the MTA on alpha examines the header to determine where to send the message, opens an SMTP connection to beta, and forwards the message to the MTA on the beta system. The SMTP dialogue requires messages to be sent in two parts: the envelope, which specifies the recipient's address (bob@beta.example.com) and the return address (alice@alpha.example.com), and the message itself, which consists of the header and body.
5. 如果beta主机的MTA拒绝这个邮件, 可能原因是在beta系统上没有这个bob用户, 在alpha 上的MTA发送一个反弹邮件给返回地址, 也就是 alice@alpha, 通知她邮件发送出现了问题. 5. If the beta MTA rejects the message, perhaps because there's no user bob on the system, the MTA on alpha sends a bounce message to the return address, alice@alpha, to notify her of the problem.
6. 如果 beta主机上的 MTA接收了邮件, 它查看接收者地址, 决定是发送给本地local 还是远程 remote系统的邮件. 这个例子里面, 接收者是本地用户, 然后MTA或者传送邮件给 mail delivery agent (MDA), 比如 /bin/mail或者传送给 procmail. 6. If the beta MTA accepts the message, it looks at the recipient's address, determines whether it's local to beta or on a remote system. In this case, it's local, so the MTA either delivers the message itself or passes it to a mail delivery agent (MDA) like /bin/mail or procmail.
7. 如果传输失败了, 可能是Bob的邮箱超过了使用限额, beta 主机上的 MTA 将发送一个反弹信息给信封上的返回地址, 即 alice@alpha. 7. If the delivery fails, perhaps because Bob has exceeded his mail quota, the beta MTA sends a bounce message to the envelope return address, alice@alpha.
8. 如果传输成功, 邮件将在Bob的邮箱中等待, 直到他使用MUA来阅读和显示邮件. 8. If the delivery succeeds, the message waits in Bob's mailbox until his MUA reads it and displays it.
C.2. 其他资料 C.2. More information
关于因特网邮件工作方式的更多信息, 请查看下面的信息: For information about how Internet mail works, see one or more of the following:
- Internet mail, 由qmail作者撰写 http://cr.yp.to/im.html . Internet mail, by the author of qmail. http://cr.yp.to/im.html
- SMTP, 由qmail作者撰写 http://cr.yp.to/smtp.html SMTP, by the author of qmail. http://cr.yp.to/smtp.html
- Internet mail message header format, 由qmail作者撰写 http://cr.yp.to/immhf.html Internet mail message header format, by the author of qmail. http://cr.yp.to/immhf.html
C.2.1. 因特网的RFC文档 Internet RFC's
Internet Requests for Comment, 缩写为Internet RFC是因特网得正式文档. 大部分Internet RFC 文档已经度过了评论期, 进入稳定状态, 他们定义了包括诸如 TCP, FTP, Telnet和各种各样得邮件标准和协议. InterInternet Requests for Comment (RFC's) are the official documentation of the Internet. Most of these are well beyond the commentary stage, and define Internet protocols such as TCP, FTP, Telnet, and the various mail standards and protocols.
- RFC 821, Simple Mail Transfer Protocol (obsoleted by RFC 2821) http://www.ietf.org/rfc/rfc0821.txt
- RFC 822, Standard for the Format of ARPA Internet Text Messages (obsoleted by RFC 2822) http://www.ietf.org/rfc/rfc0822.txt
- RFC 931, Authentication Server. http://www.ietf.org/rfc/rfc0931.txt
- RFC 974, Mail Routing and the Domain System. http://www.ietf.org/rfc/rfc0974.txt
- RFC 1123, Requirements for Internet Hosts -- Application and Support. http://www.ietf.org/rfc/rfc1123.txt
- RFC 1413, Identification Protocol. http://www.ietf.org/rfc/rfc1413.txt
- RFC 1423, Privacy Enhancement for Internet Electronic Mail: Part III: Algorithms, Modes, and Identifiers. http://www.ietf.org/rfc/rfc1423.txt
- RFC 1651, SMTP Service Extensions. http://www.ietf.org/rfc/rfc1651.txt
- RFC 1652, SMTP Service Extension for 8bit-MIMEtransport. http://www.ietf.org/rfc/rfc1652.txt
- RFC 1806, Content disposition. header. http://www.ietf.org/rfc/rfc1806.txt
- RFC 1854, SMTP Service Extension for Command Pipelining. http://www.ietf.org/rfc/rfc1854.txt
- RFC 1891, SMTP Service Extension for Delivery Status Notifications. http://www.ietf.org/rfc/rfc1891.txt
- RFC 1892, The Multipart/Report Content Type for the Reporting of Mail System Administrative Messages. http://www.ietf.org/rfc/rfc1892.txt
- RFC 1893, Enhanced mail system status codes. http://www.ietf.org/rfc/rfc1893.txt
- RFC 1894, An Extensible Message Format for Delivery Status Notifications. http://www.ietf.org/rfc/rfc1894.txt
- RFC 1939, Post Office Protocol - Version 3. http://www.ietf.org/rfc/rfc1939.txt
- RFC 1985, SMTP Service Extension for Remote Message Queue Starting (ETRN). http://www.ietf.org/rfc/rfc1985.txt
- RFC 1991, PGP Message Exchange Formats. http://www.ietf.org/rfc/rfc1991.txt
- RFC 2015, MIME Security with Pretty Good Privacy. (PGP). http://www.ietf.org/rfc/rfc2015.txt
- RFC 2045, MIME Internet message bodies. http://www.ietf.org/rfc/rfc2045.txt
- RFC 2046, MIME Media Types. http://www.ietf.org/rfc/rfc2046.txt
- RFC 2047, MIME Headers. http://www.ietf.org/rfc/rfc2047.txt
- RFC 2048, MIME Registration Procedures. http://www.ietf.org/rfc/rfc2048.txt
- RFC 2049, MIME Conformance Criteria. http://www.ietf.org/rfc/rfc2049.txt
- RFC 2142, Mailbox names for common services. http://www.ietf.org/rfc/rfc2142.txt
- RFC 2183, Content Disposition header. http://www.ietf.org/rfc/rfc2183.txt
- RFC 2821, Simple Mail Transfer Protocol. http://www.ietf.org/rfc/rfc2821.txt
- RFC 2822, Internet Message Format http://www.ietf.org/rfc/rfc2822.txt
一个综合性的邮件相关RFC列表可以在Internet Mail Consortium的web网站上找到 http://www.imc.org/mail-standards.html. A comprehensive list of mail-related RFC's is available from the Internet Mail Consortium at http://www.imc.org/mail-standards.html.
附录 D. 体系结构 Architecture
D.1. 模块化系统结构 Modular system architecture
因特网MTA可以完成多种任务. 早期如 Sendmail和 smail的设计是整体式的, 换句话说就是他们是一个大而复杂的程序, 其中一部分是SMTP服务器, 另一部分是SMTP客户端, 另外的是本地邮件注入, 还有管理邮件队列的部分,等等. Internet MTA's perform a variety of tasks. Earlier designs like Sendmail and smail are monolithic. In other words, they have one large, complex program that "switches hats": it puts on one hat to be an SMTP server, another to be an SMTP client, another to inject messages locally, another to manage the queue, etc.
qmail是模块化的, 每个功能都是由单独的程序执行的, 结果程序更小, 更简单, 而且更不容易出现功能和安全方面的问题. 为了进一步增强qmail的安全性, qmail模块以不同的权限模式运行, 模块之间互不"信任", 他们不是假定其他模块总是按照他们设计的那样去运行的. qmail is modular. Each of these functions is performed by a separate program. As a result, the programs are much smaller, simpler, and less likely to contain functional or security bugs. To further enhance security, qmail's modules run with different privileges, and they don't "trust" each other: they don't assume the other modules always do only what they're supposed to do.
这些是qmail的核心模块: The core modules are:
| 模块 Modules | 功能 Function |
| qmail-smtpd | 接收/拒收通过SMTP传递的邮件 accepts/rejects messages via SMTP |
| qmail-inject | 本地邮件注入 injects messages locally |
| qmail-rspawn/qmail-remote | 控制远程传输 handles remote deliveries |
| qmail-lspawn/qmail-local | 控制本地传输 handles local deliveries |
| qmail-send | 处理队列 processes the queue |
| qmail-clean | 清除队列 cleans the queue |
不像整体式的MTA, 模块之间的相互作用定义良好, 而且模块之间只是交换最小的必要信息. 这通常是大好事, 可是有时这种方式使处理某些事情变的困难起来. 举个例子, 为了debug目的, 运行sendmail 并使用"-v"选项, 使 Sendmail 打印它的活动跟踪消息到标准输出, 由于所有的包括邮件注入, 队列控制, 别名处理, .forward文件处理, 以及远程SMTP转发邮件等等都是由一个 sendmail 二进制程序控制, 那么可以很容易的跟踪整个邮件传送过程直到邮件被送抵目的地. 这样的等价物在qmail里面是不存在的, 如果在qmail上执行这样的"debug"过程需要实质性的改变源码以及在模块到模块之间的调试过程增加了的很大复杂性. There's also a down side to the modular approach. Unlike a monolithic MTA, the interactions between modules are well-defined, and modules only exchange the minimum necessary information with each other. This is generally A Good Thing, but sometimes it makes it hard to do things. For example, the sendmail "-v" flag causes Sendmail to print a trace of its actions to standard output for debugging purposes. Since the one sendmail binary handles injection, queueing, alias processing, .forward file processing, and remote forwarding via SMTP, it is able to easily trace the entire delivery until the message is delivered. The equivalent capability in qmail doesn't exist, and would require substantial code changes and additional complexity to implement the passing of the "debug" flag from module to module.
D.2. 文件结构 File structure
/var/qmail 是qmail的文件结构的根. 在qmail 编译安装的时候可以选择改变这个目录的位置, 不过最好还是不作改动的安装到默认位置, 这样其他的管理员就知道到哪里能找到需要的东西. 如果你真的想重新定位部分或者全部的qmail 目录树, 最好的办法是使用符号连接方式. 详细信息请参看创建目录 小节中的细目. /var/qmail is the root of the qmail file structure. This can be changed when qmail is being built, but it's a good idea to leave it unchanged so other administrators know where to find things. If you really want to relocate some or all of the qmail tree, it's better to do that using symbolic links. See the Create directories subsection of the Installation section for details.
qmail 根目录下面的一级子目录: The top-level subdirectories are:
| 目录 Directory | 内容 Contents |
| alias | 系统级别名定义的.qmail文件 .qmail files for system-wide aliases |
| bin | 二进制程序和可执行脚本 program binaries and scripts |
| boot | 启动脚本 startup scripts |
| control | 配置文件 configuration files |
| doc | 文档(不包括man 手册页) documentation (except man pages) |
| man | man 手册页 man pages |
| queue | 未送出的邮件 the queue of unsent messages |
| users | qmail-users 的数据库文件 the qmail-users database files |
D.3. 队列结构 Queue structure
在qmail的安装目录下的 INTERNALS文件更充分的讨论了有关的细节信息. 下面是一些更宽泛的队列结构的概述. The file INTERNALS in the build directory discusses the details of queueing more thoroughly. This is a broader overview of structure of the queue.
| 子目录 Subdirectory | 内容 Contents |
| bounce | 永久传送错误 permanent delivery errors |
| info* | 信封发送者地址 envelope sender addresses |
| intd | 由qmail-queue构建的信封 envelopes under construction by qmail-queue |
| local* | 本地信封接收者地址 local envelope recipient addresses |
| lock | 文件锁文件 lock files |
| mess* | 邮件文件 message files |
| pid | 由qmail-queue使用用来获得 i 节点编号 used by qmail-queue to acquire an i-node number |
| remote* | 远程信封接收者地址 remote envelope recipient addresses |
| todo | 完成的信封 complete envelopes |
注意: 由"*"标志的目录包含了一系列分开的由"0", "1",..., (最大数字直到conf-split 减去 1)这些数字命名的子目录. 这里conf-split 是由源代码目录下的conf-split 文件设定的一个参数, 在编译源码时确定, 默认是23. 分离出多个子目录是为了在繁忙的服务器上降低单个目录里面的文件数量. conf-split 必须是个质数. Note: Directories marked with an "*" contain a series of split subdirectories named "0", "1", ..., up to (conf-split-1), where conf-split is a compile-time configuration setting contained in the file conf-split in the build directory. It defaults to 23. The purpose of splitting these directories is to reduce the number of files in a single directory on very busy servers. conf-split must be a prime number.
在mess组目录吓得文件由它们的 i 节点编号命名. 这就意味着你不能使用标准的UNIX工具, 比如mv, dump/restore还有 tar来手动地移动这些文件. 这里有两个用户提供的实用工具, 可以使用它们来正确地重命名队列文件. 可以在这里http://www.qmail.org/ 找到这些工具. Files under the mess subdirectory are named after their i-node number. What this means is that you can't manually move them using standard UNIX utilities like mv, dump/restore, and tar. There are a couple user-contributed utilities on http://www.qmail.org/ that will rename queue files correctly.
注意: 当qmail正在运行地时候, 修改队列文件是不安全地. 如果你想更改队列, 首先停止 qmail, 然后仔细的处理队列, 然后重启qmail. Note: It is not safe to modify queue files while qmail is running. If you want to modify the queue, stop qmail first, play with the queue carefully, then restart qmail.
D.4. 图片 Pictures
在 /var/qmail/doc 下面有一系列的以 PIC 名字开头的文件. 这些是qmail处理不同情况的文本"图片". 它们显示了qmail 在各个模块之间处理的控制流, 在处理问题和建立复杂系统配置的时候这些图片将大有裨益. There is a series of files in /var/qmail/doc with names starting with PIC. These are textual "pictures" of various situations that qmail handles. They show the flow of control through the various modules, and are very helpful for debugging and creating complex configurations.
| 文件名 Filename | 处理场景 Scenario |
| PIC.local2alias | 本地注入邮件传递给本地别名locally-injected message delivered to a local alias |
| PIC.local2ext | 本地注入邮件传递给扩展地址locally-injected message delivered to an extension address |
| PIC.local2local | 本地注入邮件传递给本地用户locally-injected message delivered to a local user |
| PIC.local2rem | 本地注入邮件传递给远程地址 locally-injected message delivered to a remote address |
| PIC.local2virt | 本地注入邮件传递给本地虚拟域上的一个地址 locally-injected message delivered to an address on a local virtual domain |
| PIC.nullclient | 邮件注入到空用户 a message injected on a null client |
| PIC.relaybad | 使用本地主机转信失败 a failed attempt to use the local host as a relay |
| PIC.relaygood | 使用本地主机转信成功 a successful attempt to use the local host as a relay |
| PIC.rem2local | 通过SMTP为本地用户接收邮件 a message received via SMTP for a local user |
这些图片也可以在线观看, 地址如下: These files are also available on-line from:
如果你想看qmail的"真实"图片, 那么请查看Andre Opperman 的 "big qmail picture", 地址在http://www.nrg4u.com/ . If you want real pictures of qmail, check out Andre Opperman's "big qmail picture" at http://www.nrg4u.com/.
附录 E. 一些不常见的问题 Infrequently Asked Questions
一些没有资格称为常见问题的问题, 可是还是很重要也不容易回答的. These are questions that don't qualify as frequently asked, but which are important and not easy to answer.
E.1. qmail如何处理延期发送的邮件? How frequently does qmail try to send deferred messages?
每个邮件都有自己的重试时间表, 越长时间不能发送的邮件, 得到qmail重发的机会就越少. 重试时间表是不可配置的. 下面的表格显示了一个发往远程接收者的邮件, 从每次都无法发送到这封邮件被反弹的整个重试时间表. 本地传送邮件使用一个相似的不过频率更高的时间表. Each message has its own retry schedule. The longer a message remains undeliverable, the less frequently qmail tries to send it. The retry schedule is not configurable. The following table shows the retry schedule for a message that's undeliverable to a remote recipient until it bounces. Local messages use a similar, but more frequent, schedule.
| 重试次数 Delivery Attempt | 秒 Seconds | 天-小时-分钟-秒D-HH:MM:SS |
| 1 | 0 | 0-00:00:00 |
| 2 | 400 | 0-00:06:40 |
| 3 | 1600 | 0-00:26:40 |
| 4 | 3600 | 0-01:00:00 |
| 5 | 6400 | 0-01:46:40 |
| 6 | 10000 | 0-02:46:40 |
| 7 | 14400 | 0-04:00:00 |
| 8 | 19600 | 0-05:26:40 |
| 9 | 25600 | 0-07:06:40 |
| 10 | 32400 | 0-09:00:00 |
| 11 | 40000 | 0-11:06:40 |
| 12 | 48400 | 0-13:26:40 |
| 13 | 57600 | 0-16:00:00 |
| 14 | 67600 | 0-18:46:40 |
| 15 | 78400 | 0-21:46:40 |
| 16 | 90000 | 1-01:00:00 |
| 17 | 102400 | 1-04:26:40 |
| 18 | 115600 | 1-08:06:40 |
| 19 | 129600 | 1-12:00:00 |
| 20 | 144400 | 1-16:06:40 |
| 21 | 160000 | 1-20:26:40 |
| 22 | 176400 | 2-01:00:00 |
| 23 | 193600 | 2-05:46:40 |
| 24 | 211600 | 2-10:46:40 |
| 25 | 230400 | 2-16:00:00 |
| 26 | 250000 | 2-21:26:40 |
| 27 | 270400 | 3-03:06:40 |
| 28 | 291600 | 3-09:00:00 |
| 29 | 313600 | 3-15:06:40 |
| 30 | 336400 | 3-21:26:40 |
| 31 | 360000 | 4-04:00:00 |
| 32 | 384400 | 4-10:46:40 |
| 33 | 409600 | 4-17:46:40 |
| 34 | 435600 | 5-01:00:00 |
| 35 | 462400 | 5-08:26:40 |
| 36 | 490000 | 5-16:06:40 |
| 37 | 518400 | 6-00:00:00 |
| 38 | 547600 | 6-08:06:40 |
| 39 | 577600 | 6-16:26:40 |
| 40 | 608400 | 7-01:00:00 |
E.2. 为什么我无法给一个有很多MX记录的大站点发送邮件? Why can't I send mail to a large site with lots of MX's?
如果你得到下面的错误提示: If you're getting:
deferral: CNAME_lookup_failed_temporarily._(#4.4.3)/
出问题的原因是qmail不能处理名字服务器返回的大尺寸查询反馈. 安装 djbdns 来解决这个问题. 参考高级话题下面的 补丁 小节. The problem might be that qmail can't handle large name server query responses. The fix is to install djbdns. See Patches under Advanced Topics.
不过也有一些人使用这样的系统但是却没有遇到这样的问题. 本质上说, 这取决于对你本地名字服务器查询的定时和排序, 名字服务器对于"aol.com"的ANY查询返回的可能是大于512 字节 的 UDP 数据包, 或者可能不是. There's also a question as to why some people don't have trouble reaching such systems. Basically, depending on the timing and ordering of queries made to your local nameserver, the size of the response to an ANY query for "aol.com" may be larger than the 512 byte limit of a UDP packet, or it may not.
"可能不是" 这种情况可能是碰巧查询的A记录和MX记录超时, 而NS记录没有超时. 由于 .COM的服务器设置的TTL记录生命期为2天, 而AOL的TTL只有1个小时, 这种超时现象会经常在较少的某些比较忙的名字服务器上发生. 比较忙碌的名字服务器更大的可能在所有开放时间把这些记录放在他们的高速缓存中. 查询超时而又没有打补丁的qmail将会试着去查询CNAME记录. "May not" is likely to happen if the A and MX records time out, but the NS records don't. Since the .COM servers set a 2 day TTL on those, but AOL sets a 1 hour TTL on their records, this will often happen on less busy nameservers. Busier nameservers are more likely to have those records in their cache at any given time, frustrating an unpatched qmail's attempts to check for CNAMEs.
一个更好的测试方式是发送邮件到nosuchuser@large-mx.ckdhr.com这里; 如果邮件被清除出了你的邮件队列, 并且从ckdhr.com反弹信息给你, 就表明你的MTA可以发送邮件给拥有超过512字节MX列表记录的主机. (如果使用单一查询项目, 在意个TTL生命期中, 尽管查询结果超过了512字节, 可是由于单一查询不依赖于定时和排序, 这个问题将不会被表现出来) A better test is to send mail to nosuchuser@large-mx.ckdhr.com; if it clears your queue and winds up bouncing from ckdhr.com, your MTA can send mail to hosts with MX lists that exceed 512 bytes. (By using a single RRset, with a single TTL, that exceeds 512 bytes, the problem can be seen without depending on the timing and ordering of other queries.)
E.3. QUEUE_EXTRA 是什么? What is QUEUE_EXTRA?
QUEUE_EXTRA是一个编译时的配置参数, 用它来确定每个邮件传送的一个附加的接收者. 这个参数首先用于日志记录. 例如, FAQ里面描述的如何使用QUEUE_EXTRA来保存所有的进出邮件. QUEUE_EXTRA is a compile-time configuration variable that specifies an additional recipient that will be added to every delivery. This is used primarily for logging. E.g., the FAQ describes how to use QUEUE_EXTRA to keep copies of all incoming and outgoing messages.
要使用QUEUE_EXTRA, 编辑 extra.h 使用"Trecipient\0"这个格式确定附加的接收者, QUEUE_EXTRA的长度由QUEUE_EXTRALEN确定("\0"算成一个字符). 举一个例子: To use QUEUE_EXTRA, edit extra.h specifying the additional recipient in the format "Trecipient\0", and the length of the QUEUE_EXTRA string in QUEUE_EXTRALEN (the "\0" counts as one character). For example:
#define QUEUE_EXTRA "Tlog\0"
#define QUEUE_EXTRALEN 5
关掉正在运行的qmail. 如果你按照本文安装顺序, 运行下面的命令: Shut down qmail if it's running. If you installed the qmailctl script from the Installation section, that can be done by:
qmailctl stop
如果你没有qmailctl脚本, 你可以使用你的 启动/关闭 脚本, 或者给qmail-send发送一个TERM信号. If you don't have the qmailctl script, you should use your startup/shutdown script or send qmail-send a TERM signal.
然后重编译qmail, 使用命令: Then rebuild qmail using:
make setup check
设置 ~alias/.qmail-log 来定义你想要记录的内容. 比如, 需要记录邮件 ID(Message-ID), 那么就这样编写这个文件内容: Populate ~alias/.qmail-log with whatever logging you want. E.g., to log Message-ID's:
| awk '/^$/ { exit } /^[mM][eE][sS][sS][aA][gG][eE]-/ { print }'
最后, 重新启动qmail. Finally, restart qmail.
附录 F. 错误讯息 Error Messages
qmail的错误讯息以及他们的含义. qmail error messages and what they mean.
参见 RFC 1893 标准文档内括号内每个错误信息的说明部分. See RFC 1893 for an explanation of the error codes in parentheses.
这个附录时不完整的. This appendix is incomplete.
附录 G. 新手常见问题(Gotchas) Gotchas
这个"gotchas" 经常给qmail新手带来问题. These "gotchas" frequently cause problems for qmail newbies.
G.1. qmail 不能给超级用户发邮件. qmail doesn't deliver mail to superusers.
为了防止qmail-local以特权用户运行命令的可能性, qmail忽略所有UID是0的用户. 这个文档请看 qmail-getpw 的 man 手册页. To prevent the possibility of qmail-local running commands as a privileged user, qmail ignores all users whose UID is 0. This is documented in the qmail-getpw man page.
不过这并不意味着qmail不能给root用户传送邮件, 只是邮件传送必须由一个非特权用户来执行. 典型情况, 为root用户创建一个系统别名文件 ~alias/.qmail-root. That doesn't mean qmail won't deliver to root, it just means that such a delivery will have to be handled by a non-privileged user. Typically, one creates an alias for root by populating ~alias/.qmail-root.
G.2. qmail不能给没有主目录的用户发邮件. qmail doesn't deliver mail to users who don't own their home directory.
这是另外一个安全特色, 也是一个新手的很好的练习机会. 看看 qmail-getpw的man 手册页面吧. Another security feature, and just good general practice. This is documented in the qmail-getpw man page.
G.3. qmail 不能给名字里面含有大写字符的用户投递邮件. qmail doesn't deliver mail to users whose usernames contain uppercase letters.
qmail 将整个"本地部分" -- 邮件地址中"@" 符号左面的所有部分转换为小写. man 手册页面里面没有提到和表示, 不过代码里面有相关表示. 实际上在qmail-getpw 的 man 手册页面里面有关于qmail忽略使用大写字符名字用户的文档. qmail converts the entire "local part"--everything left of the "@" in an address, to lowercase. The man page doesn't come out and say that, but the code does. The fact that it ignores users with uppercase characters is documented in the qmail-getpw man page.
G.4. qmail处理扩展地址的时候, 用冒号(:)替换掉了点(.). qmail replaces dots (.) in extension addresses with colons (:).
这是qmail另一个安全特色. 是为了防止扩展地址里面".."和文件树冲突, 点(.)置换为冒号(:)之后, qmail就可以确定使用的每个用户的所有 .qmail 文件都位于他们的主目录下面. 这个问题存档于 dot-qmail 的 man 手册页里面. Another security feature. The purpose is prevent extension addresses from backing up the file tree using "..". By replacing them with colons, qmail ensures that all .qmail files for a user are under their home directory. Documented in the dot-qmail man page.
G.5. qmail 处理扩展地址的时候把大写字符转换成了小写字符. qmail converts uppercase characters in extension addresses to lowercase.
这是另外一个qmail转换地址的整个部分为小写字符的后果. 文档参见 dot-qmail 的 man 手册页. This is another result of the fact that qmail lowercases the entire local part of addresses. Documented in the dot-qmail man page.
G.6. qmail 不使用 /etc/hosts 文件 qmail doesn't use /etc/hosts.
qmail 从不使用 /etc/hosts 来确定一个主机名关联的IP地址. 如果你在控制文件内使用主机名而不是IP地址, qmail必须能够访问名字服务器. qmail never uses /etc/hosts to determine the IP address associated with a host name. If you use names in control files, qmail must have access to a name server.
即使在没有名字服务器的情况下, 也可以运行qmail, 在control 文件内的主机由 IP 地址确定, IP地址两边必须加上方括号([ ]). 例如: It is possible to run qmail on systems without access to a name server, though. Hosts in control files can be specified by IP address by enclosing them in square brackets ([]), e.g.:
[10.1.2.219]
实际上, 方括号不总是必要的--不过用上它们无论如何是恰当的. Actually, the square brackets aren't always necessary--but it's a good idea to use them anyway.
G.7. qmail 不在日志记录 SMTP 的活动. qmail doesn't log SMTP activity.
由于很多原因, qmail 并不记录 SMTP 的连接, 拒绝, 非法命令, 或者有效命令, tcpserver可以用来记录连接, recordio 可以用来记录整个 SMTP 对话. recordio 是 ucspi-tcp 的一部分. 这个过程存档在FAQ里面. 可以在这个地址 http://cr.yp.to/qmail/faq/servers.html#recordio 访问到它. For a number of reasons, qmail doesn't log SMTP connections, rejections, invalid commands, or valid commands. tcpserver can be used to log connections, and recordio can be used to log the entire SMTP dialogue. recordio is part of the ucspi-tcp package. The procedure is documented in the FAQ at http://cr.yp.to/qmail/faq/servers.html#recordio.
G.8. qmail 不生成邮件延迟通知. qmail doesn't generate deferral notices.
如果在几个小时内 Sendmail 无法传递邮件, 代表性的是4个小时, 它就会发送一个邮件延迟通知给邮件原始发送者. 这个通知有点像反弹邮件, 不过还不表示邮件传送永久失败了. If Sendmail is unable to deliver a message within a few hours, typically four, it sends a deferral notice to the originator. These notices look like bounce messages, but don't indicate that the delivery has failed permanently, yet.
qmail 并不发送这样的警告. 未发送邮件在队列内等待发送直到超过 queuelifetime 规定的时间后还能发送, 才会被反弹给邮件原始发送者. qmail doesn't send such warnings. An undeliverable message will only be returned to the originator after it spends queuelifetime in the queue.
G.9. qmail 由于/var/qmail/queue/lock/trigger 文件丢失、权限设置错误或者错误的文件属性设置等原因变的很慢 qmail is slow if /var/qmail/queue/lock/trigger is gone/has the wrong permissions/is a regular file.
qmail-queue 和 qmail-send 使用一个称作 /var/qmail/queue/lock/trigger 的命名管道进行通讯. 如果这个管道陷入混乱, qmail-send 将在大约半个小时内无法注意到新邮件. qmail-queue and qmail-send communicate via a named pipe called /var/qmail/queue/lock/trigger. If this pipe gets messed up, qmail-send doesn't notice new messages for a half hour or so.
最好的方式是正确设置qmail, 在源代码目录下使用"make check"命令检查. 如果不能这样作, 那么像下面这样确定一下: The best way to ensure that it's set up right is to run "make check" from the source directory. If that's not possible, make sure it looks like:
# ls -l /var/qmail/queue/lock/trigger
prw--w--w- 1 qmails qmail 0 Jul 5 21:25 /var/qmail/queue/lock/trigger
特别注意那一行开头的"p"(表明这是一个命名管道), 状态(特别是任意用户可写状态), 以及用户和用户组的归属. Pay particular attention to the "p" at the beginning of the line (says it's a named pipe), the mode (especially world writable), and the owner/group.
G.10. DNS 或者 IDENT 查询使 SMTP 变慢 DNS or IDENT lookups can make SMTP slow
如果 qmail-smtpd 对连接的反应变慢, 原因可能使由于DNS反相查询或者 IDENT 查询. 如果你 使用 tcpserver 运行 qmail-smtpd, 删除 "-h", "-p", 和 "-r" 选项, 并增加 "-H", "-P", "-R", 和 "-l hostname" 选项. If qmail-smtpd is slow to respond to connections, the problem is probably due to DNS reverse lookups or IDENT lookups. If you're starting qmail-smtpd with tcpserver, remove the "-h", "-p", and "-r" options and add "-H", "-P", "-R", and "-l hostname".
参看 http://cr.yp.to/ucspi-tcp/tcpserver.html 这里的 tcpserver 的文档查看这些选项的说明. See the tcpserver documentation at http://cr.yp.to/ucspi-tcp/tcpserver.html for an explanation of these options.
G.11. 回车(Carriage Return)和换行(CRLF)不同 Carriage Return/Linefeed (CRLF) line breaks don't work
qmail-inject 和其他本地注入机制比如 sendmail 不能正确接受DOS风格的回车/换行符. 不像 Sendmail, qmail 要求本地注入邮件使用 Unix 换行(只有 LF). 这和PHP 脚本遇到的问题一样. qmail-inject and other local injection mechanisms like sendmail don't work right when messages are injected with DOS-style carriage return/linefeed (CRLF) line breaks. Unlike Sendmail, qmail requires locally-injected messages to use Unix newlines (LF only). This is a common problem with PHP scripts.
G.12. 日志回滚造成qmail-send 和 tcpserver 停止 qmail-send or tcpserver stop working if logs back up
如果你使用第二节描述的受到监控的日志服务, 日志服务将会因为以下任何原因停止: 磁盘满, run 脚本打字错误, 日志目录配置错误, 等等. 而管道将被填满, 导致服务被阻塞, 或者被挂起. 解决这个问题(参看 故障处理)之后, 所有部分都会恢复正常. If you're logging to a supervised log service, as described in section 2, and the log service fails for any reason: disk full, typo in the run script, log directory configuration error, etc., the pipeline will eventually fill up, causing the service to block, or hang. Fix the problem (see Troubleshooting) and everything will return to normal.
G.13. qmail-smtpd 不能使地址的本地部分生效 qmail-smtpd doesn't validate the local part of an address.
假如 example.com 被列入control/rcpthosts 文件, 发给 anything@example.com 的邮件在SMTP会话期间将会被接受. 如果 anything 不是一个合法用户或者别名, qmail 将发送一个反弹邮件给信封上的发送者地址. If example.com is listed in control/rcpthosts, mail to anything@example.com will be accepted during the SMTP session. If anything isn't a valid user or alias, qmail will send a bounce message to the envelope sender address.
一些单纯的转信测试假设如果邮件被接受, 那么一定会被传送, 这是错的. 如果某人宣称你的系统使开放转信的, 你要查看通过转信的邮件的副本--包括完整的邮件头, 特别是 Received 部分--比较一下这些部分和你的日志记录. Some simpleminded relaying tests assume that if a message is accepted, it will be delivered. That's wrong. If someone claims that your system is an open relay, demand to see a copy of message relayed through it--including the complete header, especially the Received fields--then compare them with your logs.
G.14. 设置防火墙导致远程无法连接 SMTP/POP3/IMAP 服务器 Firewalls can block remote access to your SMTP/POP3/IMAP server.
如果安装了 SMTP, POP3 和 IMAP 服务器, 你可以在本机或者本地网络的主机连接到这些服务器, 但是无法从远程服务器连接, 很有可能是防火墙的问题. If you've installed an SMTP, POP3, or IMAP server, and you can connect to it from the local host or a host on the local network, but not from a remote host, a firewall might be the problem.
第一个查看的地方是服务器本身. 举例, Red Hat Linux, 使用 iptables 在默认配置下是阻塞 SMTP 服务的. 其他包过滤机制比如 ipchains 也会和这个问题有关系. The first place to look is on the server itself. Red Hat Linux, for example, blocks SMTP in the default configuration using iptables. Other packet filtering mechanisms such as ipchains may also be responsible.
也有可能是你的因特网服务提供商 (ISP) 阻塞了某些端口来防止垃圾邮件骚扰或者强制执行他们的服务条款(Terms of Service, TOS). 确认不是包过滤的原因以及你没有违反ISP的服务条款(TOS)之后, 可以联系你的ISP的技术支持解决问题. It's also possible that your Internet Service Provider (ISP) blocks certain ports to prevent spamming or enforce their Terms of Service (TOS). Contact your ISP's tech support after ensuring that packet filtering isn't responsible and that running a server doesn't violate your TOS.
G.15. 如果USER 和 LOGNAME 没有设置的话, qmail-inject 将设置邮件发送方字段(From)为匿名(anonymous) qmail-inject sets From field to anonymous if USER and LOGNAME aren't set.
如果通过 qmail-inject 发送邮件, 并且邮件不包括 From 字段, qmail-inject 将查找环境变量来得知是那个用户发送的邮件. 查找变量的顺序为: QMAILUSER, MAILUSER, USER, 然后 LOGNAME. If a message sent via qmail-inject doesn't contain a From field, qmail-inject looks for environment variables to tell it which user is sending the message. The variables it looks for, in order, are: QMAILUSER, MAILUSER, USER, and LOGNAME,
普通用户登录期间通常要设置USER和LOGNAME变量, 不过某些批处理任务, 比如以 cron 执行的任务, 将不会设置这两个环境变量. Normal user login sessions usually set one or both of USER and LOGNAME, but some batch jobs, such as those started by cron might not have either of these set.
为了使你的 cron 任务发送的邮件有一个合法的 From 字段, 请在发信之前设置一个环境变量就可以了. To cause your cron jobs to have a valid From field, set one these environment variables before sending any mail messages.
附录 H. 关于本文 Life with qmail 的常见话题 Frequently Asked Questions about Life with qmail
H.1. 这个 Life with qmail 的版本使多少? What version is Life with qmail?
这是LWQ 2003年02月23日的英文版本(翻译). This is LWQ version 2003-02-23.
H.2. 谁拥有 Life with qmail? Who owns Life with qmail?
版权所有1999-2003, David E. Sill
网址:http://Web.InfoAve.Net/~dsill/dave.html
Life with qmail is Copyright 1999-2003 David E. Sill
http://Web.InfoAve.Net/~dsill/dave.html
H.3. Life with qmail 的版权信息? How is Life with qmail licensed?
Life with qmail 使用OpenContent 1.0 版本许可证, 参见 http://www.opencontent.org/opl.shtmll.shtml 查看完整的版权许可证. 基本上, 你可以拷贝, 再发布, 或者修改 Life with qmail , 只要是重建的版本, 如果重发布, 也需要在 OpenContent 的版权许可证规定范围内. Life with qmail is covered by the OpenContent License, version 1.0. See http://www.opencontent.org/opl.shtml for the full license. Basically, you can copy, redistribute, or modify Life with qmail provided that modified versions, if redistributed, are also covered by the OpenContent License.
H.4. 我怎么取得新版 LWQ 的发布通知? How can I be notified when new releases of LWQ are made available?
发送邮件到 lwq-announce-subscribe@sws1.ctd.ornl.gov 加入 lwq-announce 邮件列表. Join the lwq-announce mailing list by sending a message to lwq-announce-subscribe@sws1.ctd.ornl.gov.
H.5. 在哪里可以为 LWQ 投稿, 捐助以及讨论它? Where can LWQ contributors and fans talk about it?
发送邮件到 lwq-subscribe@sws1.ctd.ornl.gov 加入lwq邮件列表. Join the lwq mailing list by sending a message to lwq-subscribe@sws1.ctd.ornl.gov.
H.6. Life with qmail 被翻译成其他语言了吗? Has Life with qmail been translated to language?
或许LWQ已经被翻译成了几种语言. 参见 http://lifewithqmail.org/trans.html 查看更多关于LWQ的翻译消息. Maybe. LWQ has been translated into a few languages. See http://lifewithqmail.org/trans.html for more information about LWQ translations.
H.7. Life with qmail 有没有 PostScript, PDF, plain text, 或者其他任何除了HTML的格式? Is Life with qmail available in PostScript, PDF, plain text, or any other format beside HTML?
有的, 其他格式的可以在这里 http://lifewithqmail.org/ 取得. Yes, alternative formats can be found at http://lifewithqmail.org/.
H.8. 我按照 Life with qmail 说的作了, 可是我的系统崩溃了, 或者弄坏了我的硬盘, 或者毁了我的爱情, 或者弄死了我的狗, 等等问题, 我该怎么办? (这属于老外的幽默啦. ^_^, 译者注) I used Life with qmail and it crashed my system/erased my hard disk/ruined my love life/killed my dog/etc.
我很抱歉, 真的很抱歉. 可是使用 Life with qmail 是没有任何担保的. 请参考上面提到的 OpenContent 版权许可证. 我不是为了赚钱才写Life with qmail 的, 我只是想为 qmail 社区作出一些有益的贡献. I'm sorry. Really sorry. But Life with qmail comes with no warranty. See the OpenContent License mentioned above. I didn't get paid to write it, I just wanted to contribute something useful to the qmail community.
其实, Life with qmail 并不是一个FAQ, 反而我希望这是个 NAQ (Never Asked Question). Actually, this isn't a FAQ. In fact, I hope it's a NAQ (Never Asked Question).
H.9. 我怎么为 LWQ捐赠和投稿? How can I contribute to LWQ?
请把对 LWQ 的修正意见, 建议以及抱怨等等发送到 lwq@sill.org. Please send corrections, suggestions, complaints, etc. to lwq@sill.org.
如果你想要作更大的投稿, 比如, 比如文章的新的小部分或者附录, 那太棒了! 首先请和我协商以便确认哪些我想要在LWQ里面添加的内容还有就是核实是否已经有人在作同样的工作了. If you'd like to make a larger contribution, such as a new subsection or appendix, that's great! Just check with me first to make sure the topic is something I want to cover in LWQ and that nobody else is already working on it.
如果你喜欢捐赠现金, 这个一直都是最受欢迎的 :-) 请联系我然后作安排, 或者使用 PayPal 电子支付系统. 使用 PayPal, 你可以"瞬间"把电子货币发送到我的电子邮件地址 paypal@dave.sill.org 上, 总计最小份额 0.01 美金, 而且你和我都没有任何其他花销--甚至使用信用卡转帐. 如果你用这个 https://secure.paypal.com/refer/pal=paypal@dave.sill.org 链接签约, 哪我还能得到推荐提成. If you'd like to donate cash, that's always welcome, too. :-) Contact me to make arrangements, or use the PayPal e-payment system. Using PayPal, you can "beam" e-money to the e-mail address paypal@dave.sill.org in amounts as small as $0.01 at no cost to you or me--even using a credit card. I may get a referral bonus if you sign up using this link: https://secure.paypal.com/refer/pal=paypal@dave.sill.org.
其他免费支持LWQ的方式是在 Amazon.com 购物的时候使用这个链接 http://www.amazon.com/exec/obidos/redirect-home/davesill . Another way to support LWQ at no cost to yourself is to shop at Amazon.com using this link: http://www.amazon.com/exec/obidos/redirect-home/davesill.




















