阿里云ECS搭建邮件服务

安装mailx

[root@db ~]# yum install -y mailx

[root@db ~]# vim /etc/mail.rc

设置发件人信息

.....

set from=yunwei@163.com

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

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

set smtp-auth-password=***

set smtp-auth=login

set ssl-verify=ignore

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

set smtp=smtps:设置发送邮件的服务器端口,如果是企业邮箱加上exmail

set smtp-auth-password:设置网易邮箱授权密码

set ssl-verify:忽略ssl检查

set nss-config-dir:指定证书所在的目录

 

申请证书

[root@db ~]# mkdir .certs

向163邮箱申请证书

[root@db ~]# echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > .certs/163.crt
[root@db ~]# certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt

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

列出目录下的证书

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

[root@db ~]# cd .certs/

标记证书

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

 

发送邮件

[root@db ~]# echo "test" | mail -s 'test' yunwei@163.com

 

 

posted @ 2019-09-29 15:18  Fire_Li  阅读(2412)  评论(0编辑  收藏  举报