need help with sending an email from my job

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
SPuneet
Participant
Posts: 28
Joined: Thu Jul 19, 2012 12:52 am

need help with sending an email from my job

Post 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
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post 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.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
SPuneet
Participant
Posts: 28
Joined: Thu Jul 19, 2012 12:52 am

Post by SPuneet »

i got what you are saying but that'sa workaround. Unfortunately My client needs the report in the body itself :(
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ankursaxena.2003
Participant
Posts: 96
Joined: Mon May 14, 2012 1:30 pm

Post 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
Post Reply