RHEL8
1、首先安装postfix和mailx
dnf install postfix mailx -y
2、开启postfix服务开机运行
systemctl enable --now postfix.server
3、编辑配置文件/etc/mail.rc
文件末尾添加:
set form="qq号@qq.com"
set smtp="smtps://smtp.qq.com:465"
set smtp-auth-user="qq号@qq.com"
set smtp-auth-password="qq邮箱授权码"
set smtp-auth=login
4、测试
mail -s "Test Dome" 123456@qq.com < /etc/os-release
RHEL9
1、首先安装postfix和s-nail
dnf install postfix s-nail -y
2、开启postfix服务开机运行
systemctl enable --now postfix.server
3、修改配置文件/etc/s-nail.rc
文件末尾添加:
set v15-compat
set smtp-auth=login
set from="昵称<qq号@qq.com>"
set mta=smtps://qq号:qq邮箱授权码@smtp.qq.com:465
4、测试
nail -s "Test Dome" 123456@qq.com < /etc/os-release