postfix 是一个可以取代 sendmail 的邮件服务器。它在普通机器上可以达到 sendmail 3 倍的吞吐率。而且相当安全。它可以在 www.postfix.org 下载安装过程如下:
- 编译的时候你需要让 postfix 支持 SASL 验证,使用以下选项编译:
% make makefiles CCARGS="-DUSE_SASL_AUTH -I/usr/local/include" \ AUXLIBS="-L/usr/local/lib -lsasl"
然后安装% make; make install
- 为了 postfix 能够正确发送本地邮件,请在 /etc/postfix/main.cf 加上:
myhostname = tu140066.tsinghua.edu.cn mydestination = wangyin.com, $myhostname, localhost.$mydomain
$myhostname 指明了你的主机域名,清华大学的网络给了每个人一个域名,其实就是 tuxxxxxx.tsinghua.edu.cn, xxxxxx 就是你的 IP 后面的数字,比如我的IP是166.111.140.66, 所以我的域名是 tu140066.tsinghua.edu.cn.
$mydestination 指出哪些地址是认为是你自己的地址。你应该把你的机器名(我的是 wangyin.com),$myhostname, $localhost.$mydomain 加进去。
- 为了能够使用 SASL 验证登录,把这些行加到 /etc/postfix/main.cf
smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = relayhost = mails.tsinghua.edu.cn
- 编辑口令文件 /etc/postfix/sasl_passwd。加入一行:
Your.Relay.Server your_auth_login_name:Your_PassWord
比如我的口令文件是这样的:
mails.tsinghua.edu.cn wang-y01:aDF2m@3d$q=+
当然密码不是那个 :P
- 把口令文件转成 Berkeley DB 格式:
#postmap hash:sasl_passwd
- 启动你的 postfix 服务器
postfix start