最近要帮朋友配置一个SMTP服务器,需求就是每天需要向外发送上百万封邮件,google之,发现postfix邮件服务器比较靠谱, 能够发送外部邮件,于是就选它了
操作系统:CentOS 5 32bit
postfix安装可以通过源码安装最新的版本,但是为了方便,我直接使用yum安装
sudo yum install postfix
配置文件路径:/etc/postfix/main.cf
postfix启动与停止命令:
sudo /etc/init.d/postfix startpostfix日志文件位置:/var/log/maillog
卸载sendmail
检查系统是否安装sendmail:
如果存在,卸载之
安装cyrus-sasl-2.1.23
由于在centos 源中不存在,直接通过源码安装cyrus-sasl-2.1.23.tar.gz
下载地址
./configure &&make &&make install
这个软件包的作用就是postfix邮件服务器的认证,因为如果转发外部的邮件,必须使用smtpd_recipient_restrictions选项的值check_relay_domains或者是reject_unauth_destination,二者必须选一个,而relay_damains手工来配置允许的邮件域太麻烦,所以就选用sasl认证
修改sasl配置:/etc/sysconfig/saslauthd为
# Directory in which to place saslauthd's listening socket, pid file, and so然后重启saslauthd:
sudo /etc/init.d/saslauthd restart测试saslauthd生效:
/usr/sbin/testsaslauthd -u liyg -p liyangguang在main.cf文件中加入:
#added by liyangguang
重启postfix :sudo /etc/init.d/postfix restart。
然后通过foxmail客户端配置smtp服务器地址,测试发送邮件是否成功