参考博文:
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
原文地址:http://blog.51cto.com/10019069/2106168