Redirecting file output to an email.


Recommended Posts

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

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

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.