Hi Fathima, Did you find any solution for this ? I am also facing the same issue.
Thanks Godwin On Thu, Sep 15, 2016 at 7:19 AM, Fathima Dilhasha <[email protected]> wrote: > > Hi, > > I'm trying to send an email with images within an osgi component. > > But I'm getting the following error when trying to send an email. > > *javax.mail.MessagingException: IOException while sending message;* > * nested exception is:* > * javax.activation.UnsupportedDataTypeException: no object DCH for MIME > type multipart/related; * > * boundary="----=_Part_0_765083650.1473940691764"* > * at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:625)* > * at javax.mail.Transport.send0(Transport.java:169)* > * at javax.mail.Transport.send(Transport.java:98)* > > After some search and trial & error I figured out this issue is due to the > use of javax.activation as an imported package. > > I checked the bundle dependencies and following is the details about the > bundle. > > * Imported packages* > * javax.activation; > version="0.0.0"<org.eclipse.osgi_3.9.1.v20130814-1242 [0]>* > > > I have tried the following to solve the issue. > > 1. Add following line before sending. According to [1] > > Thread.currentThread().setContextClassLoader( getClass().getClassLoader() ); > > 2. Add following. According to [1] > > MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); > mc.addMailcap("text/html;; > x-java-content-handler=com.sun.mail.handlers.text_html"); > mc.addMailcap("text/xml;; > x-java-content-handler=com.sun.mail.handlers.text_xml"); > mc.addMailcap("text/plain;; > x-java-content-handler=com.sun.mail.handlers.text_plain"); > mc.addMailcap("multipart/*;; > x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); > mc.addMailcap("message/rfc822;; x-java-content- > handler=com.sun.mail.handlers.message_rfc822"); > > > I cannot figure out what the exact problem is and any help is appreciated. > > p.s. I have a working standalone java class which is succesfully sending > emails with attachments and uses the javax activation from > activation-1.1.1.jar > > [1] > http://stackoverflow.com/questions/21856211/javax-activation-unsupporteddatatypeexception-no-object-dch-for-mime-type-multi > > -- > Fathima Dilhasha > *Software Engineer* > Mobile : +94 (0) 771663314 <%2B94%20%280%29%20773655496> > <%2B94%20%280%29%20773%20451194> > [email protected] <[email protected]> > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Godwin Amila Shrimal* WSO2 Inc.; http://wso2.com lean.enterprise.middleware mobile: *+94772264165* linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>* twitter: https://twitter.com/godwinamila <http://wso2.com/signature>
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
