Blogger Information
Blog 7
fans 0
comment 0
visits 7933
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
阿里云ECS实例邮件发送不了
yushilei的博客
Original
1149 people have browsed it

最近要做一个定时任务错误信息实时转发到邮件,由于用的阿里云服务器一直不成功,在网上找了下原因:

是因为阿里云服务器关闭了25端口,发送邮件才会显示链接超时,而且官方不允许打开该端口,而且大部分邮件都是通过25端口,在网上找了个还不错,以网易163邮箱为例,使用SSL下的465端口。

具体操作:

一、请求数字证书

mkdir -p /root/.certs/                           ####创建目录,用来存放证书

echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt                    ####向163请求证书

certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt                  ####添加一个SSL证书到证书数据库中

certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt               ####添加一个Global 证书到证书数据库中

certutil -L -d /root/.certs                         ####列出目录下证书

二、配置发件人

输入命令: vi /etc/mail.rc

配置如下

# For Linux and BSD, this should be set.

set bsdcompat

set from=xxxxxx@163.com

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

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

set smtp-auth-password=xxxxxxx  #此密码为第三方登录密码

set smtp-auth=login

set ssl-verify=ignore

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

三、测试
echo “test” | mail -s “zabbix” xxxxxxx@qq.com

登陆收件人邮箱查看
看似成功但是linux中报错:证书不被信任

四、解决最后一个问题-----证书不被信任

cd /root/.certs/ 

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

成功标志:
Notice: Trust flag u is set automatically if the private key is present.

转自https://blog.csdn.net/qq_42859864/article/details/84862977

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post