### 1.下载软件包
```
yum -y install postfix mailx
```
### 2.编辑配置文件
```vi /etc/mail.rc
# QQ邮箱
set from=xxxxxxxxx@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=xxxxxxxx@qq.com
set smtp-auth-password=xxxxxxxxxxx #填写自己的密钥
# 163邮箱 ,这两个只需要填写一个就好
set from=xxxxxxxxx@163.com
set smtp=smtp.163.com
set smtp-auth-user=xxxxxxxxxx@163.com
set smtp-auth-password=xxxxxxxxxxxxx
```
### 3.查看服务状态
```
systemctl status postfix
```
### 4.重启服务
```
systemctl enable --now postfix
```
### 5.关闭防火墙
```
systemctl stop firewalld
setenforce 0
```
### 6.发送格式
```
echo "邮件内容" | mail -s "邮件标题" 邮箱地址
#测试发送邮件
echo hello word | mail -s "test" 2041598918@qq.com
#测试发送文件
mail -s "passwd" 2041598918@qq.com < cf.zip
```