I have script to send report to the recipent along with a short decription of a message. But unfortunatly it fails to deliver the report as attachment nothing apart from the message come,
please find the part where I am getting stuck and confused ... please check out if you have any better suggestion to it.
below is the part where it should attach the file and send it but it fails to do.
please advice.
#---------------------------------------------------------------------#
# Checking for the number of SAL016 reports
#---------------------------------------------------------------------#
if [ $count -eq 0 ]
then
MESSAGE="Hi,\n\nThere are no SAL016 reports for ${name} in today's run test. \n\nThanks,\nWMG IT Operations"
echo "$MESSAGE" | mailx -s "${name} SAL016 reports for the run date of `date +%d-%b-%Y`" peter.tom@test.com
exit 1
fi
if [ $count -lt 2 ]
then
MESSAGE="Hi,\n\nOnly one SAL016 report generated for ${name} in today's run test1. \n\nThanks,\nWMG IT Operations"
echo "$MESSAGE" | mailx -s "${name} SAL016 reports for the run date of `date +%d-%b-%Y`" peter.tom@test.com
exit 1
fi
ux2dos $report1 > $report1.txt
ux2dos $report2 > $report2.txt
#---------------------------------------------------------------------#
# Sending a mail with SAL016 reports
#---------------------------------------------------------------------#
MESSAGE="Hi,\n\nPlease find the attached ${name} SAL016 Reports.\n\nThanks,\nWMG IT Operations"
$(echo "$MESSAGE"; uuencode $report1.txt ${name}_SAL016_Report1.txt; uuencode $report2.txt ${name}_SAL016_Report2.txt) | mailx -s "${name} SAL016 reports for
the run date of `date +%d-%b-%Y`" peter.tom@test.com