2021-08-10

搭建邮件服务器,在foxmail上使用xiaoming@example.com给wuneng@ceshi.com用户发一封邮件,内容为biechile。
1.首先装包
[root@localhost ~]# yum install postfix -y
[root@localhost ~]# yum install dovecot -y
[root@localhost ~]# yum install mailx -y
[root@localhost ~]# yum install cyrus-sasl* -y
2.然后配置文件
[root@localhost ~]# vim /etc/postfix/main.cf
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = m y h o s t n a m e , l o c a l h o s t . myhostname, localhost. myhostname,localhost.mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8,192.168.136.0/24
relay_domains = $mydestination
broken_sasl_auth_clients=yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

[root@localhost ~]# vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp submission
login_trusted_networks =192.168.136.0/24

[root@localhost ~]# vim /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u

3.然后关闭防火墙,selinux,启动服务
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl restart postfix
[root@localhost ~]# systemctl restart dovecot
[root@localhost ~]# systemctl restart saslauthd

4.添加用户xiaoming并修改权限
[root@localhost ~]# useradd xiaoming
[root@localhost ~]# passwd xiaoming
[root@localhost ~]# chmod 600 /var/spool/mail/*

5.又在另一台虚拟机上添加相同的服务,不需要添加认证
6.添加用户wuneng并修改权限
[root@client ~]# useradd wuneng
[root@client ~]# passwd wuneng
[root@client ~]# chmod 600 /var/spool/mail/*

7.然后进行dns配置
先装包
[root@client ~]# yum -y install bind
[root@client named]# yum -y install bind-utlis
编辑dns配置
[root@client ~]# vim /etc/named.conf
options {
directory “/var/named”;
};

zone "ceshi.com"  IN {
    type master;
    file "ceshi.named";

};

zone “example.com” IN {
type master;
file “example.named”;
};
启动服务

[root@client named]# systemctl restart named
在两台主机上添加域名解析
[root@client ~]# vim /etc/resolv.conf
nameserver 192.168.136.144

[root@localhost ~]# vim /etc/resolv.conf
nameserver 192.168.136.144

然后打开Foxmail测试,添加账号信息后发送邮件测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值