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?
この問題は、接続セキュリティにSTARTTLSを使用しているsmtp.office365.comが原因のようです。次の引数を追加して、 jenkins.xml構成ファイルを介してSTARTTLSを有効にしようとしました:
-Dmail.smtp.starttls.enable=true
- これは正しいスイッチ/パラメーターですか?
- 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>