javamail 发送失败,单独测试正常。 加入action 报以下错误,求解!

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javamail 发送失败,单独测试正常。 加入action 报以下错误,求解!相关的知识,希望对你有一定的参考价值。

org.springframework.mail.MailSendException; nested exception details (1) are:
Failed message 1:
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=us-ascii
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:356)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:403)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:308)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:297)
at com.santachi.web.action.AdminAction.SendMail(AdminAction.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
at java.lang.Thread.run(Thread.java:595)
单独的类 可以发送邮件。也就是说 必要的2个jar 、 以及端口都是开放的。

javamail API必须用到2个jar包,一个是activation.jar,一个是mail.jar,这2个架包添加进去,还要开通端口,比如我用的是stmp163的,我就需要开通pop3的110端口,跟stmp的25端口这2个端口就可以发送了 参考技术A 检查邮件的网络端口是否可以用啊 参考技术B asdas as d131231 参考技术C 好像是没有开端口,发送失败

以上是关于javamail 发送失败,单独测试正常。 加入action 报以下错误,求解!的主要内容,如果未能解决你的问题,请参考以下文章

JavaMail在Windows平台下正常发送邮件,部署到Linux后则发送失败

javamail的邮件发送有验证失败错误

javamail如何处理退信

Java发送邮件的简单实现

java Mail 发送外部邮件失败,求解,

java Mail 发送外部邮件失败,求解,