sendmail作为FreeBSD下的默认MTA,虽然功能很强大,但是设定非常复杂,postfix相比之下具有很大的优势,不仅设定简单,而且速度更快,也更安全(当然,安全与否的决定因素取决于管理员)。在FreeBSD中用postfix代替sendmail成为MTA是个不错的选择。
- 停止sendmail的运行
cd /etc/mail
make stop - 安装postfix
cd /usr/ports/mail/postfix
make install clean - 编辑/usr/local/etc/postfix/main.cf
- *** 不设也行
#设定主机名
myhostname = Sephiroth.FreeBSD.net
#设定邮件标头显示在from栏的内容
myorigin = $myhostname
#如果网卡绑定了多个IP,all表示监听所有的
inet_interfaces = all
#postfix 只有在发现 mydestination 这个项目中有写入的主机名称做为收信主机时,才会将该封信件收下来
mydestination = $myhostname, localhost.$mydomain, localhost
#对指定的IP进行relay
mynetworks = 127.0.0.0/8, hash:/usr/local/etc/postfix/access
#设定账号别名的数据库
alias_maps = hash:/usr/local/etc/postfix/aliases
alias_database = hash:/usr/local/etc/postfix/aliases - 编辑/etc/rc.conf,reboot
sendmail_enable="NO"
postfix_enable="YES"