Friday, February 28, 2014

Email Concurrent Request Output

Use below script to email any concurrent request output.

##########################################################################

P_SUBJECT=$5
P_ATTFILE=$6
P_REQUEST_OUT=$7
P_FILE=$8
P_MAIL_TO=$9

P_EMAIL_BODY=`echo xx_rcpt_email_body.txt`

echo "Subject       : "$P_SUBJECT
echo "File_Name     : "$P_ATTFILE
echo "Request_Out   : "$P_REQUEST_OUT
echo "New File_Name : "$P_FILE
echo "To eMail      : "$P_MAIL_TO
echo "Email Body    : "$P_EMAIL_BODY

#Copy the concurrent request output to different directory and rename as required
#XX_AR_RECEIPT_ATTACH is the concurrent program short name
cp $APPLCSF/$APPLOUT/XX_AR_RECEIPT_ATTACH*$P_REQUEST_OUT*PDF $XX_TOP/data/arreceipt/$P_FILE

#Use mutt plugin to send the email
mutt -e "my_hdr From: Email Test Centre <akumar@gmail.com>" -s "$P_SUBJECT" -a $P_ATTFILE $P_MAIL_TO < /XX/U1/PROD12/apps/apps_st/appl/hws/12.0.0/bin/$P_EMAIL_BODY

if [ $? -ne 0 ]
then
echo ""
echo "Failed to send mailto ${P_MAIL_TO} with mail subject ${P_SUBJECT} and file $P_ATTFILE"
echo ""
exit 1
fi
exit 0
##########################################################################