kavin

CentOS7云主机,通过mail命令发,使用465端口(smtps协议)发送邮件

kavin linux 2018-05-10 2682浏览 0

 

#创建证书

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

#信任证书

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

 

# 配置/etc/mail.rcE繁忙

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

set smtp-auth=login

set smtp-auth-user="wangyun@94ip.com"  #换成你的qq邮箱

set smtp-auth-password="ffsdfklkjsdksodihbvppsjg"  # 换成你的qq邮箱第三方登录密码

set ssl-verify=ignore

#set nss-config-dir=/etc/pki/nssdb

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

 

说明:

#smtp-auth-password的密码是qq邮箱里面设置的第三方登录密码,不是你qq的密码,在qq邮箱设置界面配置

 

测试:

echo message3 | mail -v -r "wangyun@94ip.com" -s "hello world" wangyun@94ip.com

注意:一定要带-r参数,生产上去掉-v参数


继续浏览有关 CentOSmail云主机465smtps 的文章
发表评论