echo "body part" | mutt -s "subject header file" -a radius.tar.gz -- ndgen@qmail.com
echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com
echo "This is the message body" | mutt -s "subject of message" -e 'my_hdr From:sender@company.com' -- rcv1@exg.org,jack@abc.com
#!/bin/bash
bounced='/var/log/bouncedmail/bouncedlog.txt'
filteredlist='/var/log/bouncedmail/bounced-maillist.txt'
rm -f $bounced
rm -f $filteredlist
curmonth=`date | cut -d' ' -f 2`
for var in `ls /var/log/maillog*`
do
if [ $# -eq 3 ]
then
echo "Script error please supply log filename and month For Example. scanmaillog.sh maillog-20170130 "; exit 1;
else
grep "status=bounced" $var | grep -v classic.com.np | grep $curmonth | awk '{ print $1" " $2 " "$7; }' | sed -e 's/to=<//g' -e 's/>,//g' >> /var/log/bouncedmail/bouncedlog.txt
fi
cat /var/log/bouncedmail/bouncedlog.txt | cut -d' ' -f 3 | sort | uniq >> /var/log/bouncedmail/bounced-maillist.txt
done
cat $filteredlist | grep -v "axiata" | sort | uniq > /var/log/bouncedmail/filtered.txt
cat /var/log/bouncedmail/filtered.txt | mail -s "Total: `wc -l $bounced | cut -d' ' -f1` emails bounced for month of `date | cut -d' ' -f2` 2017" -S smtp="mail.classic.com.np:25" urgen@classic.com.np,wilson@classic.com.np,jayesh@classic.com.np,manu@classic.com.np;
No comments:
Post a Comment