須要安裝如下組件:服務器
爲了省事,我是直接yum install的。dom
1
sudo
vi
/etc/postfix/main.cf
設置post
1
myhostname = mail.lzhaohao.info
2
mydomain = lzhaohao.info
3
myorigin = $myhostname
而後設置spa
1
inet_interfaces = all
2
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain,
ftp
.$mydomain
其中,inet_interfaces指定能夠鏈接郵件服務器的網卡界面;mydestination指定本郵件服務器會收下的信件的域名。rest
安裝好cyrus-sasl後code
1
sudo
vi
/etc/sysconfig/saslauthd
設置ip
1
MECH = shadow
shadow的意思是使用系統自帶的/etc/passwd,/etc/shadow進行密碼驗證,也就是系統用戶名和密碼就是郵箱的用戶名和密碼。cyrus-sasl還能夠使用LDAP等驗證方式,此處使用shadow做爲例子。
而後設置cyrus使用saslauthd這個服務來驗證:ci
1
sudo
vi
/usr/lib/sasl2/smtpd.conf
2
log_level: 3
3
pwcheck_method: saslauthd
4
mech_list: PLAIN LOGIN
再告訴postfix使用smtp驗證:域名
1
sudo
vi
/etc/postfix/main.cf
增長如下內容it
1
smtpd_sasl_auth_enable =
yes
2
smtpd_sasl_security_options = noanonymous
3
broken_sasl_auth_clients =
yes
4
smtpd_recipient_restrictions =
5
permit_mynetworks
6
permit_sasl_authenticated
7
reject_unauth_destination
驗證:
1
telnet localhost 25
2
ehlo localhost
看到250-AUTH LOGIN PLAIN字樣即表示配置成功。
安裝好dovecot後,修改配置項爲:
1
protocols = pop3
2
listen = *