服务器配置发送邮件
服务器配置发送邮件
本文来自小红的Liunx CentOS阿里云邮箱配置
使用了该作者的halo主题,发现作者的邮箱配置,因此记录一下
打开 IMAP/SMTP服务,并获取授权密码
163邮箱和QQ邮箱设置中都有对应的IMAP/SMTP开启
知己开启该服务获取授权密码即可
安装mailx
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
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
Yida!
喜欢就支持一下吧