————————————————

Linux 加密邮箱发送

发送电子邮件

  • 方式一

    • mail

      • 配置步骤

        • 安装mailx

          • yum install mailx -y
        • 修改配置文件

          • set from=xxx@qq.com
            set smtp=smtp.qq.com
            set smtp-auth-user=xxx@qq.com
            set smtp-auth-password= xxxx
            set smtp-auth=login
        • 测试邮件是否发送正常

          • echo "Hello Maxwell,这里是邮件正文." | mail -s "邮件主题" xxx@qq.com
        • 配置SSL

          • 创建证书存放目录

            • mkdir -p /root/.certs
          • 获取QQ 邮箱的 SSL 证书

            • 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 -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i ~/.certs/qq.crt
        • 测试带SSL发送

          • echo "Hello" | mail -s "Test with SSL" xxx.qq.com(目标邮箱)
        • 使用方法(在上一步基础上)

          • 添加附件

            • -a
          • 添加正文

            • 重定向或管道符
          • 添加主题

            • -s
posted @ 2022-10-18 17:17  Tjane'Blogs  阅读(92)  评论(0编辑  收藏  举报