Hello, I have created a class that sends out email. I need to put html tags inside the e-mail. Do I have to do something special with the servlet to allow the recipients to be able to receive this as an HTML document instead of plain text with a bunch of tags around it or do I need to do something special with the e-mail?? Thanks in advance.
Srividya Shiv
Ranch Hand
Joined: Jul 20, 2000
Posts: 31
posted
0
Hi U cannot directly embed HTML tags in the message in java mail.u must first convert html content types into byte source and then in the mimebodypart use setDataHandler as : mimebodypart.setDataHandler(new DataHandler(new ByteArrayDataSource(url,"text/html"))); where url is the string that contains html tags hope u are able follow this.i have some code for this,but its too lengthy to attach here.
George Carlson
Greenhorn
Joined: Aug 24, 2000
Posts: 15
posted
0
Thanks for your help. I did figure out how to do it about an hour before your reply, but I used the same methods. Thanks anyway.
joe script
Greenhorn
Joined: May 05, 2003
Posts: 11
posted
0
i do not understand how to use this code... i am doing the same thing, sending out an e-mail (from form data) that i want to format with HTML tags.. i use this to spit out the HTML to a browser: public class foodConfirm extends HttpServlet { /** * <p>Performs the HTTP POST operation * * @param req The request from the client * @param resp The response from the servlet */
But this doesn't do the trick for e-mail. The reply above says to put my string in the 'url' part, but i am not sure what that means..all the data needs to be enclosed by <html></html>. if anyone can help, i'd greatly appreciate it! thanks!