环境准备
- 准备Centos 7(阿里云)
- 安装 mailx-12.5-16.el7.x86_64 包
yum install mailx -y
- 配置 /etc/mail.rc 文件
[root@zhouxiang ~]# vi /etc/mail.rc
#在配置文件下方添加如下内容,此QQ邮箱中需开启POP3/SMTP服务
set bsdcompatset from=xxxx@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=xxxxx@qq.com
set smtp-auth-password=xxxxx
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb/
4.使用 mail 命令发送邮件进行测试
# 如下进行发送邮件测试,注意下方还有一段报错信息,不用管并不影响邮件发送
[root@zhouxiang ~]# mail -s "Test 2020 mail" 2684306803@qq.com < mail.txt
[root@zhouxiang ~]# Error in certificate: Peer's certificate issuer has been marked as not trusted by the.
^C
[root@zhouxiang ~]#
网友评论