最近搭了一个邮件服务器，把过程记录下来。我已经尽量精炼语句，写出来还是超长，可能直接把人吓退了。确实是这样，自建邮件服务器的人力维护成本不低，一般可以先考虑 Mailgun 之类的服务，遇到第三方服务不好的地方（成本、QQ 送达率）再考虑自建。
这篇文章包含了 Postfix 这些方面配置：
- MX 记录
- SASL 验证
- SPF 记录
- DKIM 签名
过程用到 telnet 和 openssl 调试 smtp 对话，所以了解一些 smtp 协议更好。
如果需要深入学习，建议从这本书看起：Postfix 权威指南 http://book.douban.com/subject/1754499/
不过，我不太赞同独立 IP 可以解决 IP limit，我贴一段 Mailgun 的详细说明，从多种情况进行了分析：
Do I need a dedicated IP address?
It depends on various factors.
If you are sending a lot of email (greater than 50k per week), it is a good idea to have a dedicated IP in order to isolate your reputation. If you are sharing your IP, you are sharing your reputation with those other senders. In addition, ESPs limit the total volume per IP, per hour. If you are a high volume sender you should consider a pool of IPs. However, you will have trouble establishing your reputation if you are not sending enough volume consistently from an IP - in this case, a shared IP is preferred.
If your email sending is volatile with large spikes of volume, ESPs may assume those large spikes are spam. Also, if your overall volume is too low, they won’t acknowledge your reputation. Generally, if you are sending less than 5,000 emails per day, a shared IP may be the right solution.
The other thing to consider is using separate IPs for your bulk and transactional mail. There are a couple reasons for this:
Delivery of time-sensitive transactional emails may get queued behind a large batch of bulk/marketing emails. Your transactional mail will be affected by the reputation created by your bulk/marketing mail. Mailgun’s infrastructure mitigates some of the argument’s for a dedicated IP address. First of all, we are constantly monitoring our shared IP addresses for any reputation issues. We also allow you to schedule delivery of your emails by using the o:deliverytime parameter. This allows you to delay the delivery by using a time in the future and also allows you to jump other messages in your queue (say from a large bulk mailing) by using a delivery time of now.