Java Mail 发送邮件失败问题:Sending the email to the following server failed
2015-04-03 09:42
711 查看
转自:http://student.csdn.net/space.php?uid=51562&do=blog&id=13670
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.163.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
at org.apache.commons.mail.Email.send(Email.java:1163)
at com.newer.servlet.EmailServlet.doPost(EmailServlet.java:45)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.mail.AuthenticationFailedException: failed to connect
at javax.mail.Service.connect(Service.java:322)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1128)
... 16 more
查了很多资料,终于解决了。
做发送邮件的这个功能基本上做了一天,从昨天中午开始一直到凌晨一点,还是没解决掉,人都快崩溃了,开始是mail.jar和activation.jar这两个包没有导入,导入后就报上面这个连接异常。早上4:00多醒来了,实在睡不着。起来打开电脑,突然想起昨晚临睡前看email协议,邮件服务器,pop3,smtp.程序实在找不出什么错误,灵光一闪,就进入邮箱账号看看邮箱设置,发现没有开启pop3.smtp服务。开启后,邮件就能发送成功了。
所以在做发送邮件的java,或者jsp测试前,一定要记得把邮箱的pop3.smtp服务开启。所以有时候你的程序根本没有错误,但就是会出现一些让你根本就想不到得错误,这时候就得看看与你程序相关的一些其它的服务是否与程序的运行有关了,邮件发送时是这样,还有一个web项目比较常见的是银行付款。
查了一些资料,163邮箱在2005年以后注册的邮箱没有提供pop3.smtp服务,只有付费邮箱才有这个功能。
因此最好是用QQ邮箱或者sina邮箱进行测试,并且记得一定要开启pop3.smtp服务。
希望能给像我一样在程序路上前进的朋友能有一些帮助,因为我找着错误的时候,网上的帖子基本上没讲到这个,就是本身程序以外的而有关第三方产品的服务而导致的异常
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.163.com:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
at org.apache.commons.mail.Email.send(Email.java:1163)
at com.newer.servlet.EmailServlet.doPost(EmailServlet.java:45)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.mail.AuthenticationFailedException: failed to connect
at javax.mail.Service.connect(Service.java:322)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1128)
... 16 more
查了很多资料,终于解决了。
做发送邮件的这个功能基本上做了一天,从昨天中午开始一直到凌晨一点,还是没解决掉,人都快崩溃了,开始是mail.jar和activation.jar这两个包没有导入,导入后就报上面这个连接异常。早上4:00多醒来了,实在睡不着。起来打开电脑,突然想起昨晚临睡前看email协议,邮件服务器,pop3,smtp.程序实在找不出什么错误,灵光一闪,就进入邮箱账号看看邮箱设置,发现没有开启pop3.smtp服务。开启后,邮件就能发送成功了。
所以在做发送邮件的java,或者jsp测试前,一定要记得把邮箱的pop3.smtp服务开启。所以有时候你的程序根本没有错误,但就是会出现一些让你根本就想不到得错误,这时候就得看看与你程序相关的一些其它的服务是否与程序的运行有关了,邮件发送时是这样,还有一个web项目比较常见的是银行付款。
查了一些资料,163邮箱在2005年以后注册的邮箱没有提供pop3.smtp服务,只有付费邮箱才有这个功能。
因此最好是用QQ邮箱或者sina邮箱进行测试,并且记得一定要开启pop3.smtp服务。
希望能给像我一样在程序路上前进的朋友能有一些帮助,因为我找着错误的时候,网上的帖子基本上没讲到这个,就是本身程序以外的而有关第三方产品的服务而导致的异常
相关文章推荐
- 163邮箱本地测试发送邮件成功服务器报Sending the email to the following server failed : smtp.163.com:25
- 发送邮件时候遇到了这样的一个错误!Sending the email to the following server failed : smtp.163.com:25
- commons-mail报错,提示EmailException: Sending the email to the following server failed
- Sending the email to the following server failed
- 线上问题分析:The target server failed to respond(目标服务器返回失败)
- 关于PHPmailer发送邮件失败之Failed to connect to server
- 关于PHPmailer发送邮件失败之Failed to connect to server
- 解决JMail发送邮件报错The message was undeliverable. All servers failed to receive the message的问题
- 不能发送邮件 php+smtp失败:The following From address failed
- phpmailer 生产环境发送邮件发送失败Failed to connect to server的解决办法
- To avoid email sending by programming to go into spam folder让发送的邮件到收件箱而不是垃圾邮件
- Android4.0之前HttpClient的问题The target server failed to respond
- Jmeter(the target server failed to respond)问题
- Jenkins使用Email Extension Plugin插件发送邮件失败问题小记
- Jmail发送邮件错误:The message was undeliverable. All servers failed to receive the message
- SVN问题:Cleanup failed to process the following paths: xxxxxx
- lamp 环境 下,PHPmailer 发送失败The following From address failed: 的原因
- android adb启动失败问题 adb server is out of date. killing... ADB server didn't ACK * failed to start daem
- jmail发送邮件出错,jmail.Message: The message was undeliverable. All servers failed to receive
- WinRM不起作用 Connecting to remote server failed with the following error message : WinRM cannot complete the operation