ZeRoN Posted April 15, 2004 Share Posted April 15, 2004 I need help sending the output of a file via email. This is the script i have written, it pulls virus and spam results from my maillog. rm -f /var/log/virus.csv rm -f /var/log/spam.csv grep 'MDLOG.*,virus,' /var/log/maillog >/var/log/virus.csv grep 'MDLOG.*,spam,' /var/log/maillog >/var/log/spam.csv I want to either send an email with these files as attachments or send 2 emails one with the spam contents and one with the virus contents. I would rather have the 2 emails sent to me containing the output as the body of the message. Thanks in advance. Link to comment Share on other sites More sharing options...
kemical Posted April 15, 2004 Share Posted April 15, 2004 have you looked into sendmail and sending mail through the console? Link to comment Share on other sites More sharing options...
ZeRoN Posted April 15, 2004 Author Share Posted April 15, 2004 I have sendmail installed and a fully functional server.. I need this as an automated task and I don't know how to create a script to do such.. I will make it automated via cron once it is done but I need the script first. Link to comment Share on other sites More sharing options...
kemical Posted April 15, 2004 Share Posted April 15, 2004 i mean i guess you could look on writing a bash script to send those 2 files and put it in the cron job, im sorry im not to fluent on sendmail to help with a bash script so hopefully a bit of searching google.com/linux will help Link to comment Share on other sites More sharing options...
DaveHope Posted April 15, 2004 Share Posted April 15, 2004 pipe it through mail. For example echo "test" | mail dave Link to comment Share on other sites More sharing options...
ZeRoN Posted April 15, 2004 Author Share Posted April 15, 2004 Thanks. I have got it working now. Link to comment Share on other sites More sharing options...
Recommended Posts