清测可用!
1。启动sendmail服务
service sendmail start
2.命令:
mutt -s "use sendmail" shihongbin@cstnet.cn </home/shb_tmp/mail_test.sh
mutt改为sendmail也可以~~
mutt 408160341@qq.com -s "itdhz数据备份" -a /home/backup/itdhz.sql </root/readme.txt
这段代码表示,发送邮件到 408160341@qq.com 这个邮箱,邮件主题是“itdhz数据备份”,邮件内容在 /root/readme.txt 中,邮件中包含附件 /home/backup/itdhz.sql。如果要发送多个附件,需要在每个附件前加 -a 参数。
3.sh脚本中: 直接把命令干上,定期cron执行脚本--->即可发送邮件