1
0
-1

Hi 

 

I have created my own version of EmailTool; the only major difference is that i have added 


email.addReplyTo(StringUtil.encodeEmail(replyTo));

 

Compiling is fine but when i run it in a store binder it is giving me following Exception.

 

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.sendgrid.net:2525
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
        at org.apache.commons.mail.Email.send(Email.java:1448)
        at org.joget.flow3.CustomHtmlTool$1.run(CustomHtmlTool.java:236)
        at java.lang.Thread.run(Thread.java:745)
        at org.joget.commons.util.PluginThread.run(PluginThread.java:22)
Caused by: java.lang.ClassCastException: com.sun.mail.handlers.text_plain cannot be cast to javax.activation.DataContentHandler
        at javax.activation.MailcapCommandMap.getDataContentHandler(MailcapCommandMap.java:609)
        at javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:563)
        at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:625)
        at javax.activation.DataHandler.writeTo(DataHandler.java:329)
        at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:323)
        at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1495)
        at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1125)
        at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:515)
        at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1458)
        at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2190)
        at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2151)
        at javax.mail.Transport.send(Transport.java:123)
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
        ... 4 more

 

 

I have tried many things but not working; i suspect maybe it is due to activation.jar or java mail api; Default Email tool is working fine though.

Any Idea?

 

Thanks

 

 

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi, from the error it might be a classloader issue. Maybe you could try changing the classloader, I believe there is an example at Using Hibernate Entity and Dao in Plugin

        CommentAdd your comment...