Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to add datahandler class for text/HTML mimetype  RSS feed

 
Darshan Bhavsar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends
I have one problem regarding sending HTML page.
I know it's syntext
MimeMessage msg = new MimeMessage(session)
msg.setContent(MultiPart M,"text/HTML");
But it is giving me error of Not installing datahandler for text/HTML
how to add datahandler class for text/HTML mimetype
Thanks in advance
 
Anand Vasan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am also looking same thing so if u have any updates let me know. my question is Embedding hypertext link in e-mail using java.mail
Thanks
 
Darshan Bhavsar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello anand
I found the solution of Datahandler that is surely help to u.I send u some snippet .
try this
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject(subject);
msg.setSentDate(new Date());
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(msgText1+msgText2, "text/html");
// Create a related multi-part to combine the parts
MimeMultipart multipart = new MimeMultipart();
// Add body part to multipart
multipart.addBodyPart(messageBodyPart);
// Associate multi-part with message
msg.setContent(multipart);
// Send message
Transport.send(msg);
I hope this helps u if not send me mail my id is
dmb@atul.co.in and inform me this helps u or not
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!