web-dev-qa-db-ja.com

OutlookからJenkinsの電子メール通知を構成する方法

私はこれを参照しました doc とMS 365を次のように構成しましたが、例外がスローされます。私は465ポートで試しましたが、それでも失敗し、Use SSLをチェックしていません

enter image description here

しかし、それはこの例外をスローします

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?

    at com.Sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.Java:1934)

    at com.Sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.Java:638)

    at javax.mail.Service.connect(Service.Java:317)

    at javax.mail.Service.connect(Service.Java:176)

    at javax.mail.Service.connect(Service.Java:125)

    at javax.mail.Transport.send0(Transport.Java:194)

    at javax.mail.Transport.send(Transport.Java:124)

    at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(Mailer.Java:514)

    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:39)

    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:25)

    at Java.lang.reflect.Method.invoke(Method.Java:597)

    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.Java:298)

    at org.kohsuke.stapler.Function.bindAndInvoke(Function.Java:161)

    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.Java:96)

    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.Java:121)

    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.Java:53)

    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.Java:746)

    at org.kohsuke.stapler.Stapler.invoke(Stapler.Java:876)

    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.Java:249)

    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.Java:53)

    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.Java:746)

    at org.kohsuke.stapler.Stapler.invoke(Stapler.Java:876)

    at org.kohsuke.stapler.Stapler.invoke(Stapler.Java:649)

    at org.kohsuke.stapler.Stapler.service(Stapler.Java:238)

    at javax.servlet.http.HttpServlet.service(HttpServlet.Java:848)

    at org.Eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.Java:686)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1494)

    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.Java:123)

    at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.Java:58)

    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.Java:120)

    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.Java:114)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1482)

    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.Java:48)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1482)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:84)

    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.Java:51)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.Java:117)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.Java:125)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.Java:142)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.Java:271)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.Java:93)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.Java:249)

    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.Java:67)

    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.Java:87)

    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.Java:76)

    at hudson.security.HudsonFilter.doFilter(HudsonFilter.Java:164)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1482)

    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.Java:49)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1482)

    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.Java:81)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1482)

    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.Java:30)

    at org.Eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.Java:1474)

    at org.Eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.Java:499)

    at org.Eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.Java:137)

    at org.Eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.Java:533)

    at org.Eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.Java:231)

    at org.Eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.Java:1086)

    at org.Eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.Java:428)

    at org.Eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.Java:193)

    at org.Eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.Java:1020)

    at org.Eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.Java:135)

    at org.Eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.Java:116)

    at org.Eclipse.jetty.server.Server.handle(Server.Java:370)

    at org.Eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.Java:489)

    at org.Eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.Java:960)

    at org.Eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.Java:1021)

    at org.Eclipse.jetty.http.HttpParser.parseNext(HttpParser.Java:865)

    at org.Eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.Java:240)

    at org.Eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.Java:82)

    at org.Eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.Java:668)

    at org.Eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.Java:52)

    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.Java:77)

    at Java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.Java:886)

    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:908)

    at Java.lang.Thread.run(Thread.Java:619)

Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

    at com.Sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.Java:523)

    at com.Sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.Java:355)

    at com.Sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.Java:789)

    at com.Sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.Java:1112)

    at com.Sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.Java:1139)

    at com.Sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.Java:1123)

    at com.Sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.Java:507)

    at com.Sun.mail.util.SocketFetcher.getSocket(SocketFetcher.Java:238)

    at com.Sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.Java:1900)

    ... 82 more
7
Swapnil Kotwal

最後に、問題を理解することができました。逃した

Default user e-mail suffix =  @mycompany.com

また、チェックを外しました

Use SSL

JenkinsルートディレクトリのJenkins.xmlファイルに次のパラメータを追加しました

-Dmail.smtp.starttls.enable=true      # Starts TLS for Office365 SMTP Authentication

これらは私の最後の変更です

1. SMTP server=smtp.office365.com
2. Default user e-mail [email protected]
3. Use SMTP Authentication (Checked)
4. User Name = [email protected]
5. password = ********************

 **6. Use SSL (Un-Checked)**

7. SMTP Port = 587
8. Reply-To Address = [email protected]
9. Charset = UTF8

Here is Screen Shot

ブーム... !!!

4
Swapnil Kotwal

このJava引数をJenkinsコマンドラインに追加する必要があります。

-Dmail.smtp.starttls.enable=true      # Starts TLS for Office365 SMTP Authentication

これを行うには、システムの起動時にJenkinsを開始するスクリプトを見つける必要があります。 Macでは、標準のJenkinsインストールがある場合、「/ライブラリ/ Application Support/Jenkins/jenkins-runner.sh」にあります。

そして、このように見えます:

#!/bin/bash
#
# Startup script used by Jenkins launchd job.
# Mac OS X launchd process calls this script to customize
# the Java process command line used to run Jenkins.
#
# Customizable parameters are found in
# /Library/Preferences/org.jenkins-ci.plist
#
# You can manipulate it using the "defaults" utility.
# See "man defaults" for details.

defaults="defaults read /Library/Preferences/org.jenkins-ci"

war=`$defaults war` || war="/Applications/Jenkins/jenkins.war"

javaArgs="-Dfile.encoding=UTF-8"
javaArgs="$javaArgs -Djava.awt.headless=true"
javaArgs="$javaArgs -Dmail.smtp.starttls.enable=true"
javaArgs="$javaArgs  -Dorg.Apache.commons.jelly.tags.fmt.timeZone=America/Vancouver"
javaArgs="$javaArgs -Dhudson.DNSMultiCast.disabled=true"
...
4
jpadams

warファイルの使用からジェンキンスを開始するには

Java -Dmail.smtp.starttls.enable="true" -jar jenkins.war --httpPort=9090
1
anand