Maven中的邮件发送问题

520920 发布于 2015/10/13 11:46
阅读 557
收藏 0

大家好:

    我遇到的问题是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中这种问题的解决方法,还望不吝赐教!谢谢!


加载中
0
如比如比
如比如比
不懂的路过了,mail.jar版本什么都没事哈。
返回顶部
顶部