开发者

No provider for smtp

I'm running Alfresco v3.4.0E on Tomcat v.6.0.32. Everything works fine except for sending emails through an outbound SMTP server. This is the relevant part of the stack trace I get:

Caused by: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: No provider for smtp 
    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:418)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:356)
    at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)
    at org.alfresco.repo.action.executer.MailActionExecuter.executeImpl(MailActionExecuter.java:439)
    ... 144 more
Caused by: 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:433)
    at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:387)
    ... 148 more

I already made sure that both mail.jar and activation.jar are included in the classpath:

[root tomcat]$ ll webapps/alfresco/WEB-INF/lib/ | grep mail.jar
-rw-rw-r-- 1 alfresco alfresco   356519 Jan 17 20:38 mail.jar
[root tomcat]$ ll webapps/alfresco/WEB-INF/lib/ | grep activation.jar
-rw-rw-r-- 1 alfresco alfresco    55932 Jan 17 20:38 activation.jar

Here's an excerpt from my alfresco-global.properties:

# Outbound SMTP -- sending emails from Alfresco to the outside world
mail.from.default=noreply@domain.local
mail.port=25 
mail.protocol=smtp 
mail.encoding=UTF-8
mail.header=
mail.smtp.auth=false
mail.smtp.timeout=30000
mail.host=smtp.domain.local

I already succeeded sending an email using that very same SMTP server via telnet from the Alfresco server.

What am I missing?


UPDATE

It turned out (thanks, zaphgod!) that it was all caused by some configuration problems: commenting out some properties solved the issue:

# Outbound SMTP -- sending emails from Alfresco to the outside world
mail.from.default=noreply@domain.local
#mail.port=25 
#mail.protocol=smtp 
mail.encoding=UTF-8
#mail.header=
#mail.smtp.auth=false
#mail开发者_StackOverflow中文版.smtp.timeout=30000
mail.host=smtp.domain.local

Now the question is, why this behavior? I'm pretty sure the properties I used first are with the default values..


My guess is, that the error was caused by a trailing space character in the line mail.protocol=smtp

At least in your posted config and the stack trace a space is present.


I Hope you did the following: Outbound email configuration


Could the mail or activation jar be corrupt? The error you've got does look like you don't have one of the two, so if you think they're there then one of them being incorrect/corrupt looks like the next most likely explanation

Try unzipping them (jars are zip files with metadata), and also try using something like md5sum to ensure they're the one you expected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜