gpt4 book ai didi

windows - Windows 上的 Jenkins - 无法连接到 SMTP 主机, "Unrecognized SSL message"

转载 作者:可可西里 更新时间:2023-11-01 10:46:51 41 4
gpt4 key购买 nike

如何为在 Windows 上运行的 Jenkins 启用 STARTTLS?

我在 Windows 2008 服务器上运行 Jenkins,我的电子邮件通知配置了以下信息:

  • 主机:smtp.office365.com
  • 端口:587
  • SMTP 验证:正确
  • SSL:正确
  • 等...

当我运行测试时,我收到以下异常消息:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 587;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

问题似乎是由于 smtp.office365.com 使用 STARTTLS 来确保连接安全。我尝试通过 jenkins.xml 配置文件启用 STARTTLS,方法是添加以下参数:

-Dmail.smtp.starttls.enable=true

  1. 这是正确的开关/参数吗?
  2. jenkins.xml 是要更新的正确文件吗?

注意:我知道,有些人已经在他们的 Linux 环境中解决了这个问题,但我正在寻找特定于 Windows 的解决方案。下面是我当前的 jenkins.xml 文件的一个片段:

<service>
<id>jenkins</id>
<name>Jenkins</name>
<description>This service runs Jenkins continuous integration system.</description>
<env name="JENKINS_HOME" value="%BASE%"/>

<!--
if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe.
The following value assumes that you have java in your PATH.
-->
<executable>%BASE%\jre\bin\java</executable>
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 -Dmail.smtp.starttls.enable=true</arguments>
<!--
interactive flag causes the empty black Java window to be displayed.
I'm still debugging this.
<interactive />
-->
<logmode>rotate</logmode>

<onfailure action="restart" />
</service>

最佳答案

我认为参数顺序确实很重要。我必须将 -Dmail.smtp.starttls.enable=true 放在 -jar 参数之前。

-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dmail.smtp.starttls.enable=true -jar "%BASE%\jenkins.war"--httpPort=8080

关于windows - Windows 上的 Jenkins - 无法连接到 SMTP 主机, "Unrecognized SSL message",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20588186/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com