Maven中的邮件发送问题
大家好:
我遇到的问题是javax.mail.NoSuchProviderException: No provider for smtp 错误!
报错信息如下:
T E S T S ------------------------------------------------------- Running AccountEmailServiceTest log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.524 sec <<< FAILURE! testSendMail(AccountEmailServiceTest) Time elapsed: 0.483 sec <<< ERROR! org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: No provider for smtp . Failed messages: javax.mail.NoSuchProviderException: No provider for smtp ; message exception details (1) are: Failed message 1: javax.mail.NoSuchProviderException: No provider for smtp at javax.mail.Session.getProvider(Session.java:455) at javax.mail.Session.getTransport(Session.java:650) at javax.mail.Session.getTransport(Session.java:631) at org.springframework.mail.javamail.JavaMailSenderImpl.getTransport(JavaMailSenderImpl.java:521) at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:500) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:421) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340) at com.zx.cn.service.impl.AccountEmailServiceImpl.sendMail(AccountEmailServiceImpl.java:45) at AccountEmailServiceTest.testSendMail(AccountEmailServiceTest.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) Results : Tests in error: testSendMail(AccountEmailServiceTest): Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: No provider for smtp . Failed messages: javax.mail.NoSuchProviderException: No provider for smtp Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
还有一个问题,是上面看到的乱码问题,本来创建项目的时候是好的,但是eclipse删除再次导入的时候就成这样了,试了修改编码等方法,都没管用,如果有高手知道Maven中这种问题的解决方法,还望不吝赐教!谢谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不懂的路过了,mail.jar版本什么都没事哈。