返回列表 发帖

CentOS6使用mailx(使用新浪邮箱的465端口)

实验中,操作系统的版本信息:
[root@localhost ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@localhost ~]#
[root@localhost ~]# uname -r
2.6.32-696.el6.x86_64


安装发送邮件的软件包mailx可参考:CentOS6使用mailx(使用新浪邮箱的25端口)

查看已安装的mailx的版本:
[root@localhost ~]# rpm -q mailx
mailx-12.4-10.el6_10.x86_64



创建目录,用来存放证书:
[root@localhost ~]# mkdir -p /root/.certs

向新浪请求证书:
[root@localhost ~]# echo -n | openssl s_client -connect smtp.sina.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/zhuohua.crt
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = GeoTrust CN RSA CA G1
verify error:num=9:certificate is not yet valid
notBefore=Jun 20 12:27:58 2019 GMT
verify return:0
DONE

[root@localhost ~]#

[root@localhost ~]# ls /root/.certs
zhuohua.crt
[root@localhost ~]#





添加证书到证书数据库中:
[root@localhost ~]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/zhuohua.crt

[root@localhost ~]# certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/zhuohua.crt

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


[root@localhost ~]# ls /root/.certs
cert8.db  key3.db  secmod.db  zhuohua.crt
[root@localhost ~]#





修改mailx的配置文件:(使用新浪邮箱的465端口)
cat >/etc/mail.rc<< eof
set from=j2270168881@sina.com
set smtp=smtps://smtp.sina.com:465
set smtp-auth-user=j2270168881
set smtp-auth-password=授权码
set smtp-auth=login
set smtp-user-starttlsset ssl-verify=ignore
set nss-config-dir=/root/.certs
eof


发送测试邮件:
[root@localhost ~]# echo "Hello." | mail -s "Title" 2270168xxx@qq.com


笺注:
1. 阿里云服务器不允许使用TCP 25端口,但可以用TCP 465端口;
2. 新浪邮箱发送这种邮件后,在“已发送”里是没有记录的;
3. 实验中,QQ邮箱接收邮件正常;





相关文章:
使用新浪邮箱的465端口发送邮件报错(535 authentication failed)

使用Shell脚本监控本机的CPU、内存、分区的使用率
使用Shell脚本监控本机的服务运行状态

CentOS6_通过脚本发送Zabbix告警邮件(使用新浪邮箱的465端口)






#################################
#################################
亲,学习研究也要劳逸结合哦,来我微店逛逛,买点东西好好犒劳犒劳自己和家人吧^_^^_^

FaSoLa免磨陶瓷刀具 抗氧化厨房切菜刀水果刀切肉刀 寿命长
dao.png

【宝家洁】喷雾喷水拖把平板拖把大号 高档木地板除尘 不用手洗的创意拖把 懒人必备
tuoba.png

薇语馨 (促销价)6833#夏季新款收腰显瘦蝙蝠袖露肩复古雪纺连衣裙波浪裙子邻家女孩 好质量 支持无理由退货
duoyi.png

薇语馨1852真丝连衣裙套装裙两件套系带宽松大码不规则裙子女
danyi.png

返回列表