zoukankan      html  css  js  c++  java
  • centos 7 安装 mail

    yum install -y sendmail

    将下面内容粘贴到/etc/mail.rc中

    set ssl-verify=ignore
    set nss-config-dir=/root/.certs
    set from=xxx@163.com
    set smtp=smtps://smtp.exmail.qq.com:465
    set smtp-auth-user=xxx@163.com
    set smtp-auth-password=xxxx
    set smtp-auth=login

    逐行执行下面指令

    cd /root
    mkdir .certs
    echo -n | openssl s_client -connect smtp.exmail.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

    重启sendmail服务

    systemctl restart sendmail

    发送邮件

    mail -v -s "test" 351865576@qq.com< /data/content.txt

    错误:

    Error initializing NSS: Unknown error -8015.

    上面的错误是因为没有权限导致

    修复办法:

    1. 修改.certs 第三组权限为rwx

    chmod 777 -R .certs

    第一组权限:文件所有者有读的权限

    第二组权限:文件所有者的组用户有执行和读的权限

    第三组权限:不与文件所有者同组的用户有执行的权限,但是没有读的权限。

    2. 将.certs移动到/etc/mail/目录下

    3. 修改/etc/mail.rc中的/root/.certs为/etc/mail/.certs

    4. 重启服务

  • 相关阅读:
    pdf-2-eps
    使用terminator
    自动删除源文件中的指定行--sed
    apt-get update只是更新源列表?
    LoadRunner学习
    计算一个人从出生到目前一共生活了多少天
    数组的求交集和并集
    获取北京和张北的天气
    重新梳理java入门
    java 基础
  • 原文地址:https://www.cnblogs.com/zyh1994/p/10883364.html
Copyright © 2011-2022 走看看