zoukankan      html  css  js  c++  java
  • 发邮件

    [root@oldboy ~]# yum install -y mailx
    [root@oldboy ~]# vim /etc/mail.rc
    #发件人
    set from=1757528181@qq.com
    #邮件服务器
    set smtp=smtp.qq.com
    #发件人用户名
    set smtp-auth-user=1757528181@qq.com
    #发件人密码(QQ邮箱不可以使用密码,只能使用授权码)
    set smtp-auth-password=wvmggrnckcnqejhi (QQ邮箱-设置-账户-开启pop3-授权码)
    #登录方式
    set smtp-auth=login
    #邮件服务器协议及端口
    set smtp=smtps://smtp.qq.com:465
    #忽略证书
    set ssl-verify=ignore
    #指定证书位置
    set nss-config-dir=/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
    certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i ~/.certs/qq.crt
    
    /etc/mail.rc  配置了QQ的邮箱,里面的内容不注释的话,只能发到外部的邮箱,注释了才可以发给Linux普通用户(不然是空值),root用户的邮件都放在 /var/spool/mail/root 下,#(创建用户的时候默认创建一个以用户名命名的邮件文件)
    
    # 3种方式发邮件 
    [root@localhost ~]# echo -e '我是曾⽼湿'|mail -s 'biaoti' zls_mail
    
    [root@localhost ~]# mail -s '/etc/passwd' zls_mail 0< /etc/passwd
    [root@localhost ~]# mail -s '/etc/passwd' zls_mail < /etc/passwd
    
    [root@localhost ~]# mail zls_mail
    Subject: ceshi
    youjianneirong
    .
    EOT  (.结束) 不能CTRL + d 退出
    
    mail查看邮件,r回复,q退出
    
    
  • 相关阅读:
    jsTree获取选中节点和选中指定节点
    jsTree的checkbox默认选中和隐藏
    ElasticSearch 报错 failed to obtain node locks
    jstree单选功能的实现方法
    layui 报错 jQuery is not defined
    ssdb make 失败 autoconf required
    No package gcc48-c++ available
    查看yum已安装的包
    PHP 生成 UUID
    [构造][dfs树][树的重心][LOJ#3176]「IOI2019」景点划分
  • 原文地址:https://www.cnblogs.com/syy1757528181/p/12813453.html
Copyright © 2011-2022 走看看