没有 smtp 提供商
我在 Tomcat v.6.0.32 上运行 Alfresco v3.4.0E。除了通过出站 SMTP 服务器发送电子邮件外,一切正常。这是我得到的堆栈跟踪的相关部分:
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
我已经确保 mail.jar 和activation.jar 都包含在类路径中:
[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
这是我的 alfresco-global.properties 的摘录:
# Outbound SMTP -- sending emails from Alfresco to the outside world
[email protected]
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
我已经成功使用它发送了一封电子邮件与 Alfresco 服务器通过 telnet
建立相同的 SMTP 服务器。
我缺少什么?
更新
事实证明(谢谢,zaphgod!)这一切都是造成的通过一些配置问题:注释掉一些属性解决了问题:
# Outbound SMTP -- sending emails from Alfresco to the outside world
[email protected]
#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'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
[email protected]
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
[email protected]
#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
Now the question is, why this behavior? I'm pretty sure the properties I used first are with the default values..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的猜测是,该错误是由 mail.protocol=smtp 行中的尾随空格字符引起的,
至少在您发布的配置和堆栈跟踪中存在空格。
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
邮件或激活 jar 是否已损坏?您遇到的错误看起来确实没有这两个错误之一,所以如果您认为它们在那里,那么其中一个错误/损坏看起来像下一个最可能的解释
尝试解压缩它们(jar 是 zip 文件)与元数据),并尝试使用诸如 md5sum 之类的东西来确保它们是您所期望的。
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.