邮件收发服务器配置(请根据本例子进行实际配置操作)
1、安装telnet
yum -y install telnet
2、开启postfix并设置开机自启动,使用命令netstat -tnlp | grep :25查看SMTP使用的25号端口。
systemctl start postfix
systemctl enable postfix
netstat -tnlp|grep :25
3、更改主机名,vi打开/etc/hostname文件,修改hostname。保存重启电脑后生效。
vi /etc/hostname
使用命令重启虚拟机
sudo reboot
使用命令查看主机名是否生效
hostnamectl status
4、配置postfix,修改配置文件/etc/postfix/main.cf
vim /etc/postfix/main.cf
添加以下内容
5、修改完后,重启动postfix,使用telnet命令向SMTP服务器发起连接请求。
systemctl restart postfix
telnet 0 25
6、编辑完邮件信息后,查看发给的用户邮箱,可以看到已经收到邮件。
基于Dovecot的邮件收取
1、安装Dovecot
yum -y install dovecot
2、启动dovecot,并设置开机自启动
systemctl start dovecot
systemctl enable dovecot
3、查看110端口,之后使用telnet命令连接pop3服务器。
netstat -tnlp|grep :110
telnet 0 110
4、注释系统认证,启用文件认证。
将!include auth-system.conf.ext这行注释掉,把#!includeauth-passwdfile.conf.ext这行的注释去掉。
vim /etc/dovecot/conf.d/10-auth.conf
5、配置用户认证文件
vim /etc/dovecot/conf.d/auth-passwdfile.conf.ext
6、创建用户配置文件
vim /etc/dovecot/users
添加以下内容
test:{plain}test:1001:1001::/home/test
7、配置mail_location
vim /etc/dovecot/conf.d/10-mail.conf
启用第二种方式(这里有三种方式,可以选任意一种)
8、重启dovecot,使用telnet命令登录邮箱
systemctl restart dovecot
telnet 0 110