没有 smtp 提供商

发布于 2024-11-04 22:55:06 字数 2737 浏览 2 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

满地尘埃落定 2024-11-11 22:55:06

我的猜测是,该错误是由 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.

负佳期 2024-11-11 22:55:06

我希望你做到了以下几点:
出站电子邮件配置

I Hope you did the following:
Outbound email configuration

败给现实 2024-11-11 22:55:06

邮件或激活 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文