This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I 've tried several methods to send html format mail to the viewer Novell GroupWise but failed. The methods I have tried: 1. use setConent of MimeMessage and set the message type to text/html 2. create bodypart and add the content: Sb -- StringBuffer msg.setDataHandler(new DataHandler( new ByteArrayDataSource(sb.toString(), "text/html"))); 3. send the html content as attached file MimeBodyPart mbp = new MimeBodyPart(); File file = new File("Mime.822"); FileOutputStream out = new FileOutputStream(file); out.write(sb.toString().getBytes()); FileDataSource fds = new FileDataSource(file); mbp.setDataHandler(new DataHandler(fds)); msg.setContent(mbp); The sent email is plain text instead of html format and looks like: --18658963.1028124230568.JavaMail.SYSTEM.tis <HTML> <HEAD> <TITLE>Test</TITLE> </HEAD> <BODY> ... </BODY> </HTML> --18658963.1028124230568.JavaMail.SYSTEM.tis-- Can anyone help me? Any advise is very welcomed. Thanks.
jill, Please change your name to be compliant with JavaRanch's naming policy. Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name. Thanks, Cindy
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Sep 29, 2000
Assuming that you have the JavaMail API and the Java Activation Framework, you can read this article on Basic HTML Sending.