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     // 发送邮件

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

测试成功 

  • 3
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

璐程风

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值