[jboss-user] [JBoss jBPM] - Re: Problem in formatting mail text using jbpm mail tag

naseem.k do-not-reply at jboss.com
Wed Jun 6 06:02:58 EDT 2007


Hi all,

I managed to get html contents in the mail by doing some trick. It looks like the problem is with the parser thats why to escape html < tags, forums also use square brakets instead of html tags.

<mail name="M_MailAction" actors="user(nakhan81 at yahoo.co.in)" 
  | 	        	to="#{Approve}" 
  | 	        	template="jbpm.mail.templates.xml" 
  | 	        	subject="Approval Mail to Admin">
  | 	        		<text>[table border='1' cellpadding='10'][tr][td]Note When you want to use the less-than symbol in an element's attribute, remember to use the entity reference '<'. The actual character in the attribute value (or in any attribute value) makes the stylesheet an ill-formed XML document, so the XML parser will choke on it and not pass it along to the XSLT processor.[/td][/tr][/table]</text>
  | 	        	</mail>
  | 

In Mail.java class, following code replaces all square brackets to html tags.

 if(text!=null){
  |     	  text = text.replaceAll("\\[", "<");
  |     	  text = text.replaceAll("\\]", ">");    	  
  |       }

Secondly, I commented the following line.


  | if (text!=null) {
  |         message.setText(text);
  | }
  | 

and added the following line in the Mail.java class


  | MimeMultipart mp = new MimeMultipart();
  | MimeBodyPart mainMsgPart = new MimeBodyPart();      
  | mainMsgPart.setContent(text, "text/html");
  | mp.addBodyPart(mainMsgPart);	
  | message.setContent(mp);
  | 


Please share your comments on this.

Warm Regards,
Naseem

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4051653#4051653

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4051653



More information about the jboss-user mailing list