Html Email by Dssendmail Routine

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
syedmuhammedmehdi
Participant
Posts: 43
Joined: Wed Feb 12, 2014 12:34 pm
Location: Hyderabad, India

Html Email by Dssendmail Routine

Post by syedmuhammedmehdi »

Hi, I want to send automatic email from datastage sequence through dssendmail routine but i want to send html mail having a html table in body of email. Could you please advise can we sent html email thru dssendmail?
SyedMuhammadMehdi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You can't.

Probably best to write a script to do that and then use the Execute Command stage instead. Either that or you'd need to copy the DSSendMail routine to a new name and modify it to do what you need. Depending on where your skill set lies.
-craig

"You can never have too many knives" -- Logan Nine Fingers
syedmuhammedmehdi
Participant
Posts: 43
Joined: Wed Feb 12, 2014 12:34 pm
Location: Hyderabad, India

Post by syedmuhammedmehdi »

thanks, Ok, I'm using below command from execute command stage but it is not converting tags into proper html format and just getting it as plain text, could you please advise what may be the issue with the below command?


echo "<html><b>Hello</b></html>"| mail -s "$(echo -e "This is Subject\nContent-Type: text/html")" muhammed@abc.com;
SyedMuhammadMehdi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Involve your UNIX admins / experts at your site.

What O/S is this? I'm not familiar with "mail" but have used "sendmail" and "mailx" but again not to try to send HTML email. Are you certain it is allowed by your recipient's email system? I haven't bothered because everything is converted to plain text by our email servers, hence the question.
-craig

"You can never have too many knives" -- Logan Nine Fingers
syedmuhammedmehdi
Participant
Posts: 43
Joined: Wed Feb 12, 2014 12:34 pm
Location: Hyderabad, India

Post by syedmuhammedmehdi »

It is UNIX. Yes, it is allowed by recipient 's email system. In plain text actually the issue is one code which is in proper alignment for one text type ex:- Calibri will necessarily will not be in proper alignment for all other types i.e. Arial, Times etc so I want to create it using html table with <td> <tr> tags.
Also, yes I tried by using mailx but it did not work. Can we use sendmail command in one line so that it can be executed by execute command stage?
SyedMuhammadMehdi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That question seems like something Google could easily answer for you. And if you can't do it all in one line, write a script to handle it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
MounikaP
Premium Member
Premium Member
Posts: 6
Joined: Mon Nov 06, 2017 3:48 am

Post by MounikaP »

I think the below should work.

echo "<html><b>Hello</b></html>"| /usr/bin/mail -s "$(echo "This is Subject\nContent-Type: text/html")" muhammed@abc.com;
Thanks and Regards,
Mounika P
syedmuhammedmehdi
Participant
Posts: 43
Joined: Wed Feb 12, 2014 12:34 pm
Location: Hyderabad, India

Re: Html Email by Dssendmail Routine

Post by syedmuhammedmehdi »

I build header and body email file in datastage and then used command

cat email.txt | /usr/bin/sendmail -t -oi

and it worked.
SyedMuhammadMehdi
Post Reply