mutt

安装:

yum -y install sendmail
yum install -y mutt

配置:

find / -name Muttrc
cp /etc/Muttrc /root/.muttrc
vim /root/.muttrc

 set charset="utf-8"

 set rfc2047_parameters=yes

 set use_from=yes

set from="[email protected]"

 set realname="cookie"


脚本发送邮件:

cat bin/test.sh 
#!/bin/bash
#by cookie
logdir=/www/cookie.com/log.cookie.com
logname=phpstat*.log

mailContent=mailContent
>"$mailContent"


cd $logdir
tar zcvf log.tar.gz $logname


echo -e "Dear all!\n" >> $mailContent
echo -e "\t PHPSTAT。烦请查收。" >> $mailContent
cat $mailContent | mutt -s "PHPSTAT " [email protected] -c [email protected] -c [email protected] -a log.tar.gz

rm -rf log.tar.gz
rm -rf mailContent
rm -rf $logname

定时任务:(每天凌晨三点执行一次)

crontab -e
0 3 * * * /bin/bash /root/bin/test.sh


你可能感兴趣的:(Linux命令大全)