如何在centos7服务器上使用qq发送邮件

CentOS7服务器默认安装了mailx

#如果没有请执行
yum install  mailx 
#编辑发送的配置文件
vi   /etc/mail.rc 

注意如果使用qq发送邮件,请向登陆你的qq邮箱设置中,配置你的个人发送权限
获得个人的 授权码

# This is the configuration file for Heirloom mailx (formerly
# known under the name "nail".
# See mailx(1) for further options.
# This file is not overwritten when 'make install' is run in
# the mailx build process again.

# Sccsid @(#)nail.rc    2.11 (gritter) 8/2/08
set from=limexxxxxx@qq.com

set smtp=smtps://smtp.qq.com:465

set smtp-auth-user=xxxxx6xxxxxxx@qq.com

set smtp-auth-password=kbdykrqqjytxbfdh

set smtp-auth=login

set ssl-verify=ignore

set nss-config-dir=/root/.certs

:wq 保存 /etc/mail.rc

#还需要添加邮箱证书到本地
# 创建证书目录
mkdir -p /root/.certs/
# 获取证书内容                    
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
# 添加证书到数据库
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt

# 列出指定目录下的证书
certutil -L -d /root/.certs
# 在命令行里发送邮件会提示“Error in certificate: Peer's certificate issuer is not recognized.”这样的证书没有获得认可的警告提示,需要执行下面指明受信任证书、防报错的命令
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i ~/.certs/qq.crt

如果出现

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

GeoTrust SSL CA                                              C,,  
[root@122 ~]#  certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i ~/.certs/qq.crt
Notice: Trust flag u is set automatically if the private key is present.

说明配置成功,快发送一个邮件到自己邮箱看看吧
-s 加邮箱标题 ,记得使用自己的qq 发送哦
echo “邮件内容lmk” | mail -s “来自我的服务器” 734449600@qq.com

在这里插入图片描述
配置完成

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yuemake999

请我喝茶呗

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值