Liunx CentOS阿里云邮箱配置
前言
本站由阿里云轻量服务器
搭建 不支持25
端口 所以使用465
发送邮件,如果腾讯云
可用25
端口
打开163/QQ邮箱的 IMAP/SMTP服务,并获取授权密码
阿里云服务器键入如下命令,按自己需求配置163/QQ即可!
yum -y install mailx
vim /etc/mail.rc 在最后面添加下面参数,邮箱账号和援权密码根据自己的填写
163邮箱
#163配置参数
set from=授权密码的邮箱号
set smtp=smtps://smtp.163.com:465
set ssl-verify=ignore
set nss-config-dir=/root/.certs
set smtp-auth-user=授权密码的邮箱号
set smtp-auth-password=邮箱授权密码
set smtp-auth=login
#创建163邮箱证书密匙
mkdir /root/.certs
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
certutil -L -d /root/.certs
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/ -i ~/.certs/163.crt
QQ邮箱
#QQ邮箱参数
set from=授权密码的邮箱号
set smtp=smtps://smtp.qq.com:465
set ssl-verify=ignore
set nss-config-dir=/root/.certs
set smtp-auth-user=授权密码的邮箱号
set smtp-auth-password=邮箱授权密码
set smtp-auth=login
#创建QQ邮箱证书密匙
mkdir /root/.certs
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 ~/.certs
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/ -i ~/.certs/qq.crt
测试
echo "测试发送邮件" | mail -s "Title" 接收信息邮件@qq.com