记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

Centos 7下如何配置SMTP SSL(邮箱发送功能)

简介: Centos 7下如何配置SMTP SSL(邮箱发送功能)

1.安装openssl
yum install -y openssl openssl-devel
2.安装mailx
yum -y install mailx
3.启用SSL功能

mkdir -p /root/.certs/
cd $HOME
echo n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE/,/END CERTIFICATE/p' > ~/.certs/qq.crt 
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -L -d /root/.certs

说明:在执行以上命令过程中,如果没有出现错误提示,说明操作成功;否则需要把这个问题解决才能做后面的操作
4.配置mail.rc文件
vim /etc/mail.rc

在mail.rc文件末尾增加如下内容

set from=
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=
set smtp-auth-password=
set smtp-auth=login

set ssl-verify=ignore
set nss-config-dir=/root/.certs

#使用qq邮箱来发送邮件

set from=XXXXX@qq.com    #你要使用的邮箱地址

set smtp=smtps://smtp.qq.com:465   #使用qq.com的465加密端口

set smtp-auth-user=18163201@qq.com   #登录邮箱使用的账号

set smtp-auth-password=dcnhslrkexdbbgbh  #qq邮箱开启POP3/SMTP服务时提供的密码,

set smtp-auth=login    #用户名和密码登录

set ssl-verify=ignore   #使用ssl加密

set nss-config-dir=/etc/pki/nssdb/   #指定ssl证书所在的位置

然后发送测试邮件:

[root@zlx ~]# echo 123 | mail  -s "test Email" 18163201@qq.com

接受成功



转载请标明出处【Centos 7下如何配置SMTP SSL(邮箱发送功能)】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论