As part of an acquisition I have inherited a ERP system running on a SCO 5 server, unfortunately I don't have much Unix knowledge. I have been asked to configure a script so that when users print a report from the ERP software it runs a script that sends the report to the users mailbox as an email attachment. I have no idea how to do this.
I know mail is set up on the server and I know how to configure the ERP so it prints to a script but I don't know what should go in that script.
Our mail system is MS Exchange if that makes a difference.
Could any give me a idiots guide on how to do this?
Some of the variables are defined earlier in the script. However, this might provide some basics of emailing a file attachment to people.
echo "#### Emailing the reports"
# create summary for email
echo "Summary Report of items un-processed ${DataSet} data ">$msgtxt
echo "Script name = ${SCRIPT} " >>$msgtxt
# over-ride default set by unix
m_frv='set from=abc@xyz.com; set realname="Client Automation"'
m_subj="Items Analysis"
# recipient
m_recipients="jg@xyz.com"
# people to get cc copies
m_recipients_cc="group@xyz.com"
# determine the size of the file attachment; if greater than 65k lines do not send
# Excel does not like these long files; email may not like to send large files
csv_cnt=$(wc -l ${workx4} | awk '{print $1}')
if [ $csv_cnt -lt 65000 ]
then
/usr/local/bin/mutt -nx -e "$m_frv" -s "$m_subj" -a "$workx4" -c "$m_recipients_cc" "$m_recipients" <$msgtxt
else
/usr/local/bin/mutt -nx -e "$m_frv" -s "$m_subj" -c "$m_recipients_cc" "$m_recipients" <$msgtxt
fi