安裝Postfix來配置SMTP服務器. SMTP使用25/TCP.服務器
[root@mail ~]# yum -y install postfixdom
[root@mail ~]# vi /etc/postfix/main.cfide
# line 75: 去掉註釋並修改主機名post
myhostname = mail.example.com雲計算
# line 83: 去掉註釋而且定義域名spa
mydomain = example.comunix
# line 99: 去掉註釋rest
myorigin = $mydomainorm
# line 116: 修改ip
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