HOME> 伊涅斯塔世界杯> Linux mailx发送邮件到QQ邮箱(测试成功)

Linux mailx发送邮件到QQ邮箱(测试成功)

2025-07-01 13:53:30

Linux mailx发送邮件到QQ邮箱(测试成功)

QQ邮箱设置授权码 安装

yum install mailx # centos

sudo apt-get install heirloom-mailx # ubuntu

编辑配置文件

vim /etc/mail.rc

添加如下内容

set from=**4306@qq.com # 对方收到邮件时显示的发件人

set smtp=smtps://smtp.qq.com:465 # 第三方发邮件的smtp服务器地址

set smtp-auth-user=xx4306@qq.com # 第三方发邮件的用户名

set smtp-auth-password=************ # 授权码

set ssl-verify=ignore

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

set smtp-auth=login # SMTP的认证方式

运行以下命令生成一个证书(逐行复制回车)

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.”提示,运行以下命令即可。

cd /root/.certs/

ll

certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt

测试

echo "测试邮件" | mail -s -v "测试" 83xx@qq.com

耵聹栓塞

冰室是香港市井的魂,跟茶餐厅可不大一样

最新发表 newmodule
友情链接 newmodule