linux centos 阿里云服务器mail发送邮件(使用465端口、避开25端口) - Go语言中文社区

linux centos 阿里云服务器mail发送邮件(使用465端口、避开25端口)


阿里云ESC服务器现在基本是把25的封了,要申请解封也很难,阿里云给出的建议是使用465端口。

我这里不使用自建的邮件收发服务,使用第三方像163的邮箱发送邮件QQ邮箱配置基本一样。

1. 163邮箱 设置

在163邮箱里点设置,勾选上收发服务,如下图。

 然后再打开客户授权码

这样邮箱这边设置就完成了,然后回到ESC服务器上云设置。

2. 阿里云ESC服务器上设置

[root@ald8 /]# yum -y install mailx

[root@ald8 /]# vim /etc/mail.rc          // 在最后面添加下面参数,邮箱账号和援权密码根据自己的填写

#-----------------自定义-----------------

set from=ald8cn@163.com

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

set ssl-verify=ignore

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

set smtp-auth-user=ald8cn@163.com

set smtp-auth-password=授权密码

set smtp-auth=login

 然后配置证书密匙,执行下面命令即可。

[root@ald8 /]# mkdir /root/.certs

[root@ald8 /]# echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt

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

[root@ald8 /]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt

[root@ald8 /]#  certutil -L -d /root/.certs

[root@ald8 /]#  certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/ -i ~/.certs/163.crt

接着就是测试了

[root@ald8 ~]# echo 'aa' | mail -s 'sss' adl8cn@163.com     // 发送邮件

打开邮箱查看收到了,测试成功。

测试成功 

版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/cbuy888/article/details/88287883
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-03-08 15:18:49
  • 阅读 ( 1901 )
  • 分类:Linux

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢