Well…this was kind of a pain to get working, for an idiot like me. I wanted to get a tarred version of a particular log file via email – as an attachment – and I had no idea where to start. In other words, I wanted to have an email sent to me, with an attachment, using an automated (cron driven) script. The following little script, which uses mutt, did the trick. I found the info on the net, somewhere. The script, below, deletes an old .tar file and creates a new one, then performs the mail function (the important part). The “message.txt” file is the body of the email. A big thank you to someone, somewhere – I can’t recall where I finally dug this up.
rm -rf logs.tar
tar -cvf logs.tar logs
cp ***tar /root
mutt -s “Qtrap Logs” -a logs.tar email@example.com,firstname.lastname@example.org \
And my mail looks like this: