本站由阿里云轻量服务器搭建 不支持25端口 所以使用465发送邮件,如果腾讯云可用25端口

打开163/QQ邮箱的 IMAP/SMTP服务,并获取授权密码

阿里云服务器键入如下命令,按自己需求配置163/QQ即可!

yum -y install mailx
   
vim /etc/mail.rc  在最后面添加下面参数,邮箱账号和援权密码根据自己的填写
163邮箱
#163配置参数
set from=授权密码的邮箱号

set smtp=smtps://smtp.163.com:465
 
set ssl-verify=ignore
 
set nss-config-dir=/root/.certs
 
set smtp-auth-user=授权密码的邮箱号
 
set smtp-auth-password=邮箱授权密码
 
set smtp-auth=login

#创建163邮箱证书密匙
mkdir /root/.certs

echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
 
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
 
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
 
certutil -L -d /root/.certs
 
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/ -i ~/.certs/163.crt
QQ邮箱
#QQ邮箱参数
set from=授权密码的邮箱号

set smtp=smtps://smtp.qq.com:465
 
set ssl-verify=ignore
 
set nss-config-dir=/root/.certs
 
set smtp-auth-user=授权密码的邮箱号
 
set smtp-auth-password=邮箱授权密码
 
set smtp-auth=login

#创建QQ邮箱证书密匙
mkdir /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 ~/.certs

certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/ -i ~/.certs/qq.crt
echo "测试发送邮件" | mail -s "Title" 接收信息邮件xx@qq.com
文章作者: 小红
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 小红
Liunx linux
喜欢就支持一下吧