sendmail邮件自动发送

配置邮件自动发送:

1.安装软件

    yum -y install sendmail mailx

2.发送邮件的邮箱授权

    eg:y******@126.com

网页网易云邮箱登陆 --> 设置 --> POP3/SMTP/IMAP --> 设置授权密码(y*****126)

3. vim /etc/mail.rc

    set from=y******@126.com

    set smtp=smtp.126.com

    set smtp-auth-user=y*****@126.com

    set smtp-auth-password=y*****126  #授权码

    set smtp-auth=login

4.systemctl restart sendmail

5.测试:

    echo '数据库CSV报表' | mail -s "数据库CSV报表邮件" -a /root/bbb 135*******@qq.com

  注:查看qq邮箱,可能在垃圾箱里。

6.周期性计划:

crontab -e

* * * * *   echo 'huan 这是亲切的问候' | mail -s "best wishes"  135*******@qq.com

猜你喜欢

转载自www.cnblogs.com/huandada/p/9415341.html