安装Postfix来配置SMTP服务器. SMTP使用25/TCP.
[root@mail ~]# yum -y install postfix
[root@mail ~]# vi /etc/postfix/main.cf
# line 75: 去掉注释并修改主机名
myhostname = mail.example.com
# line 83: 去掉注释并且定义域名
mydomain = example.com
# line 99: 去掉注释
myorigin = $mydomain
# line 116: 修改
inet_interfaces = all
# line 164: 添加
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# line 264: 去掉注释并且按照你本地局域网环境修改
mynetworks = 127.0.0.0/8, 192.168.96.0/24
# line 419: 去掉注释 (use Maildir)
home_mailbox = Maildir/
# line 574: 添加
smtpd_banner = $myhostname ESMTP
# 在最后面添加以下内容
# limit an email size for 10M
message_size_limit = 10485760
# limit a mailbox for 1G
mailbox_size_limit = 1073741824
# for SMTP-Auth
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
[root@mail ~]# systemctl restart postfix
[root@mail ~]# systemctl enable postfix
安装Dovecot来配置POP/IMAP服务器。POP使用110/TCP, IMAP使用143/TCP.
[root@mail ~]# yum -y install dovecot
[root@mail ~]# vi /etc/dovecot/dovecot.conf
# line 24: 去掉注释
protocols = imap pop3 lmtp
# line 30: 去掉注释并修改 ( 如果不使用IPv6 )
listen = *
[root@mail ~]# vi /etc/dovecot/conf.d/10-auth.conf
# line 10: 去掉注释并修改 ( 允许明文认证 )
disable_plaintext_auth = no
# line 100: 增加
auth_mechanisms = plain login
[root@mail ~]# vi /etc/dovecot/conf.d/10-mail.conf
# line 30: 去掉注释并添加
mail_location = maildir:~/Maildir
[root@mail ~]# vi /etc/dovecot/conf.d/10-master.conf
# line 96-98: uncomment and add like follows
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
[root@mail ~]# vi /etc/dovecot/conf.d/10-ssl.conf
# line 8: 修改 (不使用SSL)
ssl = no
[root@mail ~]# systemctl start dovecot
[root@mail ~]# systemctl enable dovecot
本文出自 “11830455” 博客,请务必保留此出处http://11840455.blog.51cto.com/11830455/1836505
Linux与云计算——第二阶段Linux服务器架设 第九章:Mail电子邮件服务器架设—postfix和Dovecot
原文地址:http://11840455.blog.51cto.com/11830455/1836505