Page 1 of 1

need help with sending an email from my job

Posted: Tue Oct 09, 2012 2:39 am
by SPuneet
Hi,
I need assitance with sending out an email after i am done with my processing in my job.

I the end i need to send out an email with following details
From: <my email address>
To: <list of email addresses of recipients>
Subject: Daily failure stats
Body:
stats for 9-OCT-2012, followed by trends over the past 4 weeks:

Total Failure %Failure Transaction
2 2 100.00 PW Reset
20 20 100.00 DB Login
204 57 27.94 Inq Bill

--------------- --------------- --------------- --------------- --------------------------------------------------
--------------- --------------- --------------- --------------- --------------------------------------------------
9-OCT-2012 2-OCT-2012 25-SEP-2012 18-SEP-2012 Transaction
100.00 NA NA NA PW Reset
100.00 NA NA NA DB Login
27.94 NA NA NA Inq Bill


I have all these calculated in my job..m not sure how to send the above content as an email. i haven't done that earlier. Kindly help

regards,
SPuneet

Posted: Tue Oct 09, 2012 3:14 am
by BI-RMA
Hi,

You say that you have calculated the statistics you want to include in an e-mail within the predecessing job.

Write the statistics to a flat-file and attach the file to your e-mail.

Of course: You can also try to parameterise the built-in routine DSSendMail, but you would still have to write the statistics to a file within a parallel job, then read the file in the sequence and set the parameters used by the routine to the correct values. Much more troublesome, though.

Posted: Tue Oct 09, 2012 6:15 am
by SPuneet
i got what you are saying but that'sa workaround. Unfortunately My client needs the report in the body itself :(

Posted: Tue Oct 09, 2012 7:27 am
by chulett
Then you'll need to build your own interlude to sendmail as it's not possible out of the box. Look at the DSSendMailTester routine for some help with that.

Posted: Tue Oct 09, 2012 7:38 am
by ankursaxena.2003
I have got the below code from http://www.unix.com/shell-programming-s ... ments.html link.
And I have used this one. It works.

Code: Select all

#!/usr/bin/ksh

export MAILTO="email_address"
export CONTENT="/export/home/aisdba/email_body.html"
export SUBJECT="subject of email"
(
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 cat $CONTENT
) | /usr/sbin/sendmail $MAILTO