• 在阿里云ECS服务器发送QQ邮件


    我们知道阿里云ECS服务器默认禁用25端口。所以我们可以使用465端口(邮件的ssl端口)来进行邮件的发送。

    1.我们先在安全组开放465端口。

    2.然后需要配置QQ邮箱的(SMTP服务的设置)。具体设置方法自行百度。在此不再说明。

    3.在服务器上配置关闭其它的邮件工具

           service sendmail stop    chkconfig sendmail off  停止sendmail服务并取消开机自启  (centos6.x)

    service postfix stop      chkconfig postfix off     停止postfix服务并取消开机自启

    4.安装mailx。(Linux下一种邮件软件) 

    yum install mailx -y

    5.请求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 -A -n “GeoTrust SSL CA – G3” -t “Pu,Pu,Pu” -d ~/.certs/./ -i qq.crt    # 这里需要注意的是在执行这条命令时,所执行的路径必须是/root/.certs/ 否则将会报错

    certutil -L -d /root/.certs

    6.配置/etc/mail.rc

    set from=2975502691@qq.com

    set smtp=smtps://smtp.qq.com:465

    set smtp-auth-user=2975502691@qq.com

    set smtp-auth-password=xxxx #授权码

    set smtp-auth=login

    set ssl-verify=ignore

    set nss-config-dir=/root/.certs

    7.发送邮件并测试是否成功

    echo “hello,world” | mail -s “测试邮件” 2975502691@qq.com

  • 相关阅读:
    day54——Python 处理图片
    day53——Python 处理 Excel 数据
    day52——Python 处理附件
    day51——爬虫(一)
    大数据治理体系简谈
    redis环境的安装
    微服务体系操作日志如何记录?
    mysql数据库设计规范
    win系统下git代码批量克隆,批量更新
    java实现二维码登录功能
  • 原文地址:https://www.cnblogs.com/love-vce/p/12751568.html
Copyright © 2020-2023  润新知