Mails from shell script

Hello Gurus,
I am facing some issues while doing the automation of some progs.
The requirement is if any prog fails with error automatically the script will send alert for such failed progs.

Below is the table structure:-

PROG_NAME                                                Description
QFEQGL Journal Import Wrapper               email1@xx.com,yy@xx.com
QFEQGL FDW Reconciliation                     email2@xx.com,bm@xx.com
QFEQAR FVS Customers Ext                     email3@xx.com,bm@xx.com

Now for every prog failed the script will send the mails as per the emails entered at description.

How to write the script.

Thanks-
P

Ok. So how do you tell if

QFEQGL

failed. There is nothing you showed us to allow us to do that. Doest it run from crontab, some batch operation, constantly?

We need a lot more information.

Please show us what you have done so ar.