• 发邮件


    [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退出
    
    
  • 相关阅读:
    bzoj1007: [HNOI2008]水平可见直线(单调栈)
    1264: [AHOI2006]基因匹配Match(动态规划神题)
    bzoj1433: [ZJOI2009]假期的宿舍(最大二分图匹配)
    bzoj3931: [CQOI2015]网络吞吐量(spfa+网络流)
    [ZJOI2007]矩阵游戏
    [HAOI2007]覆盖问题
    [ZJOI2008]树的统计
    [ZJOI2010]数字计数
    [HAOI2006]旅行
    [HAOI2006]数字序列
  • 原文地址:https://www.cnblogs.com/syy1757528181/p/12813453.html
Copyright © 2020-2023  润新知