send a mail from java5 and java6

孤人 提交于 2019-12-01 13:10:34

First check to make sure there are no other copies of mail.jar, smtp.jar (old), or activation.jar. (The last is most likely, as you may have bundled activation.jar as it was not included in JDK 1.5).

If that does not work, or you can't control that due to the environment your plugin is being run from, try to explicitly set your context classloader to the system classloader prior to creating the mail instance.

Reference (end of page): http://old.nabble.com/javax.activation.UnsupportedDataTypeException:-no-object-DCH-for-MIME-type-multipart-mixed-td12523671.html.

This can now also be fixed by upgrading java to the latest 1.6.0.x. I'm not sure when this was fixed, but going from x=6 to x=27 fixed this for me.

For those working in Web applications and getting this error, putting this in your startupservlet's service() fixes the issue.

Thread.currentThread().setContextClassLoader( getClass().getClassLoader() ) . Thanks Marc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!