今天按照往常想安装mail进行测试,结果yum源怎么也没有mailx安装包,经过rocky官方文档解释,新版rocky9以上的mailx用s-nail取代。若之前有mailx的安装包也不会删除。
安装postfix s-nail,记得开启服务
[root@rocky9 ~]# yum install -y postfix s-nail
配置s-nail配置文件
[root@rocky9 ~]# vi /etc/s-nail.rc
set from="XXX@qq.com"
set smtp="smtp.qq.com"
set smtp-auth-user="xxx@qq.com"
set smtp-auth-password="邮箱密钥"
set smtp-auth=login
发送邮件
root@rocky9 ~]# echo "this is test mail" | s-nail -s "mail" XXX@qq.com