centos-sendmail&mail发送邮件

版权声明:转载请注明出处。 https://blog.csdn.net/paopaohll/article/details/84102206

一、安装:

  1. 安装sendmail:

    yum  -y  install  sendmail
    systemctl  start  sendmail
    
  2. 安装mailx:

    yum install -y mailx
    

二、发送:

  1. 通过文件内容发送:

    mail  -s  'subject'  [email protected]  <  example.txt 
    
  2. 通过管道符直接发送:

    echo  'content'  |  mail  -s  'subject'  [email protected]
    

    三、设置发件人信息:vim /etc/mail.rc

    set [email protected]
    set smtp=smtp.163.com
    set [email protected]
    set smtp-auth-password=密码
    set smtp-auth=login
    

    四、查看队列:

    mailq
    

    五、查看日志:

    tail  /var/log/maillog
    

猜你喜欢

转载自blog.csdn.net/paopaohll/article/details/84102206