美文网首页菜鸟程序员
centos7.5 mail发送邮件配置

centos7.5 mail发送邮件配置

作者: Freeasthew_a098 | 来源:发表于2019-11-21 11:09 被阅读0次

    参考文章:https://blog.csdn.net/djhsun/article/details/78731683

    1.安装sendmail mailx

    2.获取QQ邮箱证书

    mkdir -p /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 /root/.certs
    #切换到证书所在目录
    cd /root/.certs/
    certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu"  -d ./ -i qq.crt
    

    3 配置mail.rc

    set from=xxx@host.cn                             #发送方邮件地址
    set smtp=smtps://smtp.exmail.qq.com:465          #邮件服务器
    set smtp-auth=login                              #验证方式/登录验证
    set smtp-auth-user="xxx@hosts.cn"                #发送方用户权限验证
    set smtp-auth-password="xxxxxxxxxx"              #发送方验证密钥(非邮箱密码 授权密码)
    set ssl-verify=ignore
    set nss-config-dir=/root/.certs
    #set nss-config-dir=/etc/pki/nssdb
    

    4 重启sendmail 和 服务器
    systemctl restart sendmail
    reboot
    5.测试发送邮件

    echo "mail content" | mail -s "title" ding@qq.com
    

    成功

    相关文章

      网友评论

        本文标题:centos7.5 mail发送邮件配置

        本文链接:https://www.haomeiwen.com/subject/qtizictx.html