Author |
Message
|
cool_dev |
Posted: Tue Jul 08, 2008 7:10 am Post subject: [Solved] Does EmailOutput node supports HTML msg ? |
|
|
Newbie
Joined: 08 May 2008 Posts: 6
|
Hi,
anybody knows if there is a way to send off msg with the EmailOutput node but providing the full html (including DTD, head and body tags) and NOT just the body content ?
To be more precise, WMB 6.1 is used and the flow looks like this: MQInput -> Compute -> EmailOutput
Code: |
SET OutputRoot.EmailOutputHeader.Subject = 'Test html email';
SET OutputRoot.EmailOutputHeader.To = test@test.com;
SET OutputRoot.EmailOutputHeader.From = me@me.com;
SET OutputLocalEnvironment.Destination.Email.BodyContentType = 'text/html';
|
Now the email message is provided thanks to a templating engine, so I simply get it and set the email msg with it:
Code: |
DECLARE emailMsg CHARACTER;
SET emailMsg = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID 1208);
SET OutputRoot.XML = emailMsg;
-- Don't work either
-- SET OutputRoot.XMLNSC = emailMsg;
-- SET OutputRoot.XMLNSC.Message = emailMsg;
|
The result from the above is an email body with unwanted tags Email and Body that screw up the msg display in the email reader
Code: |
<Email><Body> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html> <!-- Actual email content -->
</html>
</Body></Email>
|
Any idea on how to get rid of the Body and Email tags to display the provided code as is ?
Last edited by cool_dev on Thu Jul 10, 2008 2:11 pm; edited 1 time in total |
|
Back to top |
|
 |
kirankinnu |
Posted: Tue Jul 08, 2008 7:45 am Post subject: |
|
|
 Centurion
Joined: 12 Jun 2004 Posts: 128 Location: Chicago, IL
|
You Have to build the message in this fashion:
SET OutputRoot.XMLNSC.Message.Body[1] = 'Test 123';
SET OutputRoot.XMLNSC.Message.Body[1].br = '';
SET OutputRoot.XMLNSC.Message.Body[2] = 'Thank you,';
SET OutputRoot.XMLNSC.Message.Body[2].br = '';
SET OutputRoot.XMLNSC.Message.Body[3] = '--------------';
Build all the HTML tags in XML tree format.. |
|
Back to top |
|
 |
cool_dev |
Posted: Tue Jul 08, 2008 8:00 am Post subject: |
|
|
Newbie
Joined: 08 May 2008 Posts: 6
|
Thank's for the reply kirankinnu,
well, I am trying to avoid to generate all the content (including tags) directly from WMB. The reason is that the email content is built with a third party sw running on WAS, resulting in an html page. This page is then sent to WMB prior to be sent out to SMTP server.
Now it would be much helpful to be able to sent out this html page as is, in the email msg... |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Jul 08, 2008 9:08 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
I hae created several flows that send HTML formated messages with the EmailOutputNode.
The ESQL builds the HTML page as a character string. So in theory if you can get at the data you get from WAS as a character string then you should be able to achieve what you want.
The HTML I format includes <h1>, <H2>, <B>, <BR> & <P> tags. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
cool_dev |
Posted: Thu Jul 10, 2008 2:10 pm Post subject: |
|
|
Newbie
Joined: 08 May 2008 Posts: 6
|
The issue was fixed using a JavaCompute node where a BLOB parser element is created, then the actual BLOB is added as the last child.
Code: |
outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", html.toString().getBytes()); |
|
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jul 10, 2008 10:42 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
You really don't have to use a Java Compute node to achieve this.
In none of the flows I have written that send HTML formated email, use a JCN.
Actually, in the 7 years I have been using Message Broker, I have never had to use a JCN (ok they were not available with V2.0.x etc). ESQL has always been able to meet the requirements.
Its not that I don't know Java. I am currently working with Lotus Expeditor Client.
Still, its good to know that you have managed to get it working _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|