CentOS7.8通过QQ邮箱实现邮件报警
2020-12-01 本文已影响0人
IT大表哥
测试环境:CentOS7(只基于虚拟机)
1、在浏览器登录我们的QQ邮箱,找到设置选择账户。

2、然后下来找到如下图所示界面,将POP3服务开启,开启时需要向腾讯发送一条短信进行认证。

3、发完短信后会出现下图的界面,会有一个授权码,其实这个也就相当于是密码,下面的操作会用上。

二、安装邮件客户端工具 mailx
[root@localhost ~]# yum install mailx
[root@localhost ~]#vim /etc/mail.rc ##在文件的最后,添加以下几行
set from=发件人邮箱@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=邮箱用户名
set smtp-auth-password=自己设定的 授权密码
set smtp-auth=login

三、测试邮件发送功能
1.给自己发送邮件,首先先确保自己能连网
[root@localhost ~]# ping smtp.qq.com ##是否能ping 通。如果不通,请检查网络

2.进行测试
[root@localhost ~]# echo "邮件内容"|mail -s "邮件标题" 邮箱地址(例如:1008610000@qq.com)

3.验证测试效果
