阿里云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 // 发送邮件
打开邮箱查看收到了,测试成功。
测试成功