ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SendMailPlugIn(HTML format)

Post new topic  Reply to topic
 SendMailPlugIn(HTML format) « View previous topic :: View next topic » 
Author Message
broker_new
PostPosted: Thu May 29, 2008 6:53 pm    Post subject: SendMailPlugIn(HTML format) Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

I have done a lot of research in sending an email in HTML format.
My flow contains the following nodes.
MQInput-->>Compute---->>SendMailPlugIn

MQInput takes XML message and in compute node the From,To,Subject fields are set.By default it sends the message in plain text format(ContentType="text/plain).
My requirement is to send it in text/html format.
I have set it different formats with the following statements but iam not able to send it in HTML format.

1)SET OutputLocalEnvironment.Destination.ContentType = 'text/html' ;
2)SET OutputRoot.Properties.ContentType = 'text/html' ;


3)SET OutputRoot.BLOB.BLOB = CAST(InputRoot.XML.Message.Body AS BLOB ccsid 1208); -- NOTE: InputRoot.XML.Message.Body points to your HTML data. Change this accordingly.

SET OutputRoot.XML.Message.Body = 'This is the body of the email';
SET OutputRoot.XML.Message.EncodingBase64.(XMLAttribute)ContentType = 'text/html';
SET OutputRoot.XML.Message.EncodingBase64.(XMLAttribute)Name = 'Sample.html';

When Step3 is implemented i was able to send it in HTML format but the message is sent as an attachment but it has to be included in the Body of Email.
Could anyone help me configuring this to send the Email in HTML format.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
dcjs
PostPosted: Fri May 30, 2008 7:46 am    Post subject: Reply with quote

Acolyte

Joined: 10 Nov 2006
Posts: 53
Location: IBM Bangalore

Broker has lot of limitations.
I dont think sendmailplugin can be configured to send Emails in HTML format.
Use Core Java to send the email.
You know all the functionalities of Broker can be implemented in Java
_________________
TRY TRY UNTIL U SUCCEED
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri May 30, 2008 7:47 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981



Set the Body to be the HTML text.

Or use EmailOutput node in V6.1.


_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
broker_new
PostPosted: Fri May 30, 2008 7:48 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

That means SendMailPlugin can't be configured to send HTML based emails to include the payload in the Body.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
broker_new
PostPosted: Fri May 30, 2008 11:15 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Jeff,
I have coded like this as you said but iam not able to get the correct output.
SET OutputRoot.XML.Message.From = 'abc@abc.com';
SET OutputRoot.XML.Message.To = 'abc@abc.com';
SET OutputRoot.XML.Message.Subject= 'Test EMail is to test the HTML Capability';
SET OutputRoot.XML.Message.Body.HTML.Body='<body bgcolor=#d4d4d4>
<h1>hello</h1></body>';

But iam getting the output as am i doing any mistake here <body bgcolor=#d4d4d4><h1>hello</h1>
</body>'
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
dcjs
PostPosted: Fri May 30, 2008 11:31 am    Post subject: Reply with quote

Acolyte

Joined: 10 Nov 2006
Posts: 53
Location: IBM Bangalore

its not correct.
Broker 6 doesn't support HTML email formatting.
_________________
TRY TRY UNTIL U SUCCEED
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed Jun 04, 2008 12:39 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

And at last i found a way to send an email in HTML format using JCN.
I created ah HTML message using a compute node and passed it to JCN.

package com.ibm.www;
import java.util.Date;
import java.util.Enumeration;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import com.ibm.broker.javacompute.MbJavaComputeNode;
import com.ibm.broker.plugin.*;
public class HTMLEmail_MsgFlow_JavaCompute extends MbJavaComputeNode {

public static int sendMail(String message) throws Exception
{
String host = "smtp-out.yahoo.com";//SMTP host address
String subj = "Test HTML Message created By Broker using a Custom Node";
String to = "abcd@abc.com";
String from = "abcd@abc.com";
StringTokenizer st = new StringTokenizer(to, ";");
Vector v = new Vector();
int cnt = 0;
while (st.hasMoreTokens())
{
v.addElement(st.nextToken());
cnt++;
}

InternetAddress[] address = new InternetAddress[cnt];
Enumeration enum1 = v.elements();

for (int i=0; i<cnt; i++)
address[i] = new InternetAddress(((String) enum1.nextElement()).trim());
// String myname = "Broker_New is the best!!";
Properties props = new Properties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, null);
// create a message
MimeMessage mimemessage = new MimeMessage(session);
MimeBodyPart mimebodypart = new MimeBodyPart();
mimebodypart.setContent(message, "text/html");
MimeMultipart mimemultipart = new MimeMultipart();
mimemultipart.setSubType("alternative");
mimemultipart.addBodyPart(mimebodypart);
mimemessage.setFrom(new InternetAddress(from));
mimemessage.setRecipients(javax.mail.Message.RecipientType.TO, address);
mimemessage.setSubject(subj);
mimemessage.setSentDate(new Date());
mimemessage.setContent(mimemultipart);
Transport.send(mimemessage);
return 0;
}

public void evaluate(MbMessageAssembly contact admin) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage inMessage = contact admin.getMessage();
MbElement root = inMessage.getRootElement();
String str = (String) root.evaluateXPath("string(./MQRFH2/usr/str)");;
try
{
sendMail(str);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed Jun 04, 2008 1:23 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

We need to understand one thing there are lot of limitations in Broker and we go for custom nodes to provide that feature using Java.

In case of sendmailplugin as it provided as a support pac it doesn't have all the features of sending an email(like the problem i faced).

But there are some limitations where we can't do anything like configuring Broker to listen on multiple HTTP and HTTPS ports.
Calling two different databases(oracle,db2..) using a single compute node.
...................

I read the documentation for 6.1 each execution group can be configured to a separate HTTP and HTTPS port and lot of new features.

Sometimes even after deleting the execution groups those will be showing up in debug mode.............
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SendMailPlugIn(HTML format)
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.