Centos6.5搭建郵件服務器(Postfix+Dovecot )
http://blog.jjonline.cn/linux/185.html
http://blog.51cto.com/11038104/1916669
第一步、關閉iptables、selinux
/etc/init.d/iptables stop
chkconfig --level 3 iptables off
vim /etc/selinux/config
SELINUX=disable
第二步、安裝Postfix、Dovecot
#centos6.5本身就帶postfix所以不用安裝
yum install dovecot telnet vim -y
第三步、配置postfix
vim /etc/postfix/main.cf
# 約75行: 取消註釋,設置
myhostname = mail.netdj.net
# 約83行: 取消註釋,設置域名
mydomain = netdj.net
# 約99行: 取消註釋
myorigin = $mydomain
# 約116行: 修改
inet_interfaces = all
#約119行: 推薦ipv4,如果支持ipv6,則可以為all
inet_protocols = ipv4
#約164行: 指定可接收郵件的主機名或域名
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#約264行: 取消註釋,指定內網和本地的IP地址範圍(可以作為client)
mynetworks = 10.0.0.0/8, 127.0.0.0/8, 192.168.0.0/16
#約419行: 取消註釋,郵件保存目錄
home_mailbox = Maildir/
#約571行: 指定MUA通過smtp連接postfix時返回的header頭信息
smtpd_banner = $myhostname ESMTP
# 添加到最後
#規定郵件單封最大尺寸為10M(單位是Byte)
message_size_limit = 5242880
# 規定收件箱最大容量為20M(單位是Byte)
mailbox_size_limit = 20971520
# SMTP認證
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions=permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
第四步、配置Dovecot
vim /etc/dovecot/dovecot.conf
# 26行: 如果不使用IPv6,請修改為*
listen = *
vim /etc/dovecot/conf.d/10-auth.conf
# 9行: 取消註釋並修改
disable_plaintext_auth = no
# 97行: 使用簡單登錄
auth_mechanisms = plain login
vim /etc/dovecot/conf.d/10-mail.conf
# 30行:指定位置
mail_location = maildir:~/Maildir
vim /etc/dovecot/conf.d/10-master.conf
# 88-90行: 取消註釋並添加
# Postfix smtp驗證
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
/etc/init.d/postfix start
/etc/init.d/dovecot start
/etc/init.d/postfix restart
/etc/init.d/dovecot restart
chkconfig dovecot on
chkconfig postfix on
第五步、創建用戶
useradd mail1 ; echo "123456" | passwd --stdin mail1
useradd mail2 ; echo "123456" | passwd --stdin mail2
Centos6.5搭建郵件服務器(Postfix+Dovecot )