查看安装
rpm -qa | grep sendmail
rpm -qa | grep dovecot
rpm -qa | grep cyrus
安装邮件服务器
yum install sendmail sendmail-cf
安装pop3/imap服务
yum install dovecot
安装用户认证
yum install cyrus-sasl
yum install cyrus-sasl-md5
yum install cyrus-sasl-plain
yum install cyrus-sasl-lib
修改sendmail配置
vi /etc/mail/sendmail.mc
取消如下两行的注释(删除开头的dnl)
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
修改SMTP的监听IP为 0.0.0.0
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
生成配置
m4 sendmail.mc > sendmail.cf
修改dovecot配置
vi /etc/dovecot.conf
去掉下面一行前面的#
#protocols =imap imaps pop3 pop3s
添加域名
vi /etc/mail/local-host-names
添加域名如:yourdomain.com //每个域名一行
修改认证方式
vi /usr/lib/sasl2/Sendmail.conf
将原内容:pwcheck_method:saslauthd
修改成:pwcheck_method:auxprop
查看映射用户
sasldblistusers2
运行 saslpasswd2 添加用户
saslpasswd2 -u yourdomain.com -a sendmail yourname@yourdomain.com
设置开机启动
chkconfig sendmail on
chkconfig dovecot on
chkconfig saslauthd on
重启
service sendmail restart
service dovecot restart
service saslauthd restart
ok,使用outlook或foxmail进行测试。