使用Postfix与Dovecot部署一个可收发的邮件系统

1.配置dns:
[[email protected] named]# yum install -y bind
1)firewall处理
[[email protected] ~]# firewall-cmd --permanent --add-service=dns
[[email protected] ~]# firewall-cmd --permanent --reload
2)主配置文件
[[email protected] ~]# vim /etc/named.conf
使用Postfix与Dovecot部署一个可收发的邮件系统
检查语法:使用Postfix与Dovecot部署一个可收发的邮件系统
3)区域配置文件
[[email protected] ~]# vim /etc/named.rfc1912.zones
使用Postfix与Dovecot部署一个可收发的邮件系统
4)数据配置文件
[[email protected] ~]# cd /var/named
[[email protected] named]# cp -a named.localhost openlab.aaa.zone

使用Postfix与Dovecot部署一个可收发的邮件系统
使用Postfix与Dovecot部署一个可收发的邮件系统测试:
[[email protected] named]# yum install bind-utils -y
使用Postfix与Dovecot部署一个可收发的邮件系统
2.配置发送邮件服务器Postfix
关掉firewalld&selinux

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# Setenforce 0

1)安装软件postfix
[[email protected] ~]# rpm -qa postfix
postfix-2.10.1-6.el7.x86_64
2)配置main.cf
[[email protected] ~]# hostnamectl --static set-hostname mail.openlab.aaa
[[email protected] ~]# cp /etc/postfix/main.cf{,.bak}
[[email protected] ~]# vim /etc/postfix/main.cf
75 myhostname = mail.openlab.aaa 设置posfix的FQDN合格域名(FQDN:(Fully Qualified Domain Name)全限定域名:同时带有主机名和域名的名称)
83 mydomain = openlab.aaa 设置运行posfix主机的域名
99 myorigin = $mydomain
116 inet_interfaces = all 监听的网络接口
164 #mydestination = myhostname,localhost.myhostname, localhost.mydomain, localhost
166 mydestination = myhostname,localhost.myhostname, localhost.mydomain, localhost, mydomain,mail.mydomain,mail.mydomain, www.mydomain,ftp.mydomain, ftp.myd omain
263 mynetworks = 192.168.233.0/24, 127.0.0.0/8 允许邮件服务的网段
295 relay_domains = $mydestination
418 home_mailbox = Maildir/

3)启动服务
语法检查:postfix check
使用Postfix与Dovecot部署一个可收发的邮件系统
测试:
1)创建两个用户tom和bob
[[email protected] ~]# useradd tom
[[email protected] ~]# echo 123 | passwd --stdin tom
[[email protected] ~]# useradd bob
[[email protected] ~]# echo 123 | passwd --stdin bob
2)使用telnet工具发送测试邮件
[[email protected] ~]# yum install telnet -y
[[email protected] ~]# telnet localhost 25
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
220 mail.openlab.aaa ESMTP Postfix
helo bob 宣告客户地址
250 mail.openlab.aaa
mail from:tom 发件人地址
250 2.1.0 Ok
rcpt to:bob 收件人地址
250 2.1.5 Ok
data 传送数据(信件)内容
354 End data with .
subject:test mail 邮件主题
hello! miss you~~~ 邮件内容
.
250 2.0.0 Ok: queued as 9A49962211AE
quit
221 2.0.0 Bye
Connection closed by foreign host.
3)检查邮件
使用Postfix与Dovecot部署一个可收发的邮件系统
使用Postfix与Dovecot部署一个可收发的邮件系统

3.配置接收邮件服务器Dovecot
1)安装软件 断开在连接主机名更改
[[email protected] ~]# yum install -y dovecot

2)配置dovecot
步骤1:要启用最基本的Devocot服务,需对文件/etc/dovecot/dovecot.conf
[[email protected] ~]# cp /etc/dovecot/dovecot.conf{,.bak}
[[email protected] ~]# vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp
30 listen = *
48 login_trusted_networks = 192.168.233.0/24

步骤2:对/etc/dovecot/conf.d/10-mail.conf配置文件作如下修改:
[[email protected] ~]# vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir

3)启动服务
[[email protected] ~]# systemctl --now enable dovecot
使用Postfix与Dovecot部署一个可收发的邮件系统
使用Postfix与Dovecot部署一个可收发的邮件系统

测试:使用telnet接收邮件测试
使用Postfix与Dovecot部署一个可收发的邮件系统