vi /etc/hosts
192.168.40.133 mail.test.com
systemctl stop firewalld
systemctl disable firewalld
vi /etc/selinux/config
(1)检查系统是否已经安装了postfix服务器
rpm -q postfix
(2) 如果没有就安装,安装了就跳过
yum -y install postfix
(3) 编辑postfix的配置文件,查找并修改对应配置项
vi /etc/postfix/main.cf
在文件最后添加如下内容
myhostname = mail.test.com
mydomain = test.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, $mydomain
home_mailbox = Maildir/
mynetworks = 0.0.0.0,127.0.0.0/8,60.60.60.0/24 // 网络权限(根据现场IP配置,粘贴进去的时候去掉//后面的所有内容)
(4) 检查配置文件是否有语法错误
postfix check
如果报错
postfix: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
则需要找到libmysqlclient.so.18这个文件放进服务器
先确认/usr/local/mysql/lib/下是否有libmysqlclient.so.18这个文件.
修改ld.so.conf文件
执行ldconfig使其生效
(5) 重新启动postfix服务器
systemctl restart postfix
(1) 添加邮件账号组
groupadd mailusers
(2)添加邮箱账号
useradd -g mailusers -s /sbin/nologin dkycs
passwd dkycs
useradd -g mailusers -s /sbin/nologin dfc
passwd dfc
(3) 安装远程登录插件
yum install -y telnet
(4) 远程登录25端口,如报错连接不上,重启postfix
telnet mail.test.com 25
(5)测试邮件发送
[root@localhost new]# telnet mail.test.com 25 //执行前面的命令
Trying 192.168.40.133...
Connected to mail.test.com.
Escape character is '^]'.
220 mail.test.com ESMTP Postfix
#执行telnet mail.test.com 25就会显示上面的内容 表示telnet连接成功
mail from:
#复制上面一行的代码的,表示邮件发送者
250 2.1.0 Ok
#表示ok
rcpt to:[email protected]
#to:后面表示邮件接收者,如果有报错往后面看有解决办法
250 2.1.5 Ok
data
#data加回车开始编写邮件
354 End data with .
Subject:test mail
#邮件主题
hello serva 3D_city
hello serva 3FD
hello 3D!thanks!
#邮件内容
.
#.表示编写结束 发送邮件
250 2.0.0 Ok: queued as 21C5340F1992
#发送成功
quit
#退出telnet
221 2.0.0 Bye
Connection closed by foreign host.
如果报错就修改下列文件:
vi /etc/postfix/main.cf
mynetworks = all
systemctl restart postfix
(6)接收查看邮件内容
cd /home/收件人/Maildir/new目录下,所有新收的邮件都在这个下面:
yum -y install dovecot
安装完,查看版本:
dovecot --version
(1)执行vi /etc/dovecot/dovecot.conf
修改如下:
protocols = imap pop3
listen = *, ::
login_trusted_networks = 0.0.0.0,127.0.0.0/8,60.60.60.0/24 (根据现场配置填写)
!include conf.d/*.conf
!include_try local.conf
(2)执行
vi /etc/dovecot/conf.d/10-ssl.conf
修改如下:
ssl = no
(3)执行
vi /etc/dovecot/conf.d/10-auth.conf
修改如下:
disable_plaintext_auth = no
auth_mechanisms = plain login
!include auth-system.conf.ext
(4)执行vi /etc/dovecot/conf.d/10-logging.conf
修改如下:
info_log_path = /var/log/dovecot_info.log
debug_log_path = /var/log/dovecot_debug.log
(5)执行vi /etc/dovecot/conf.d/10-mail.conf
修改如下:
mail_location = maildir:~/Maildir
systemctl start dovecot
systemctl enable dovecot
systemctl status dovecot
查看端口:
yum -y install net-tools
netstat -tlnp |grep dovecot
安装:
yum install rng-tools -y
service rngd start
安装/配置:
yum install bind-utils -y
yum install dnsmasq -y
vi /etc/dnsmasq.conf
最后一行添加
address=/test.com/127.0.0.1
listen-address=127.0.0.1,192.168.40.133(本机ip)
service dnsmasq start
测试 nslookup
test.com
Foxmail官方下载地址:http://fox.foxmail.com.cn/
账号配置:
、