How to change the security type from SSL to TLS in Jenkins?

I am trying to setup the smtp email notification. I could see that the gmail part works fine. I want to configure it for my office 365.

Smtp server =

  • Jenkins - groovy script - get last successful build date in dd-mm-yyyy format
  • BitBucket Jenkins doesn't automatically build
  • How can I configure Jenkins to show my logs in the workspace?
  • Github-plugin for Jenkins get committer and author name
  • Jenkins and git
  • how to add developers list in pom.xml file.whenever the build fails it will send notifications
  • We don’t have SSL configured. Instead we use TLS. How can I set the TLS in the Jenkins?
    There is only a check button which suggests to use SSL or not. If I disable it what is it going to use?

    I get the following errors –

    Failed to send out e-mail
    javax.mail.MessagingException: Could not connect to SMTP host:, port: 587;
      nested exception is: Unrecognized SSL message, plaintext connection?
        at com.sun.mail.smtp.SMTPTransport.openServer(
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(
        at javax.mail.Service.connect(
        at javax.mail.Service.connect(
        at javax.mail.Service.connect(
        at javax.mail.Transport.send0(
        at javax.mail.Transport.send(
        at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.kohsuke.stapler.Function$InstanceFunction.invoke(
        at org.kohsuke.stapler.Function.bindAndInvoke(
        at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(
        at org.kohsuke.stapler.MetaClass$1.doDispatch(
        at org.kohsuke.stapler.NameBasedDispatcher.dispatch(
        at org.kohsuke.stapler.Stapler.tryInvoke(
        at org.kohsuke.stapler.Stapler.invoke(
        at org.kohsuke.stapler.MetaClass$6.doDispatch(
        at org.kohsuke.stapler.NameBasedDispatcher.dispatch(
        at org.kohsuke.stapler.Stapler.tryInvoke(
        at org.kohsuke.stapler.Stapler.invoke(
        at org.kohsuke.stapler.Stapler.invoke(
        at org.kohsuke.stapler.Stapler.service(
        at javax.servlet.http.HttpServlet.service(
        at org.eclipse.jetty.servlet.ServletHolder.handle(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at hudson.util.PluginServletFilter$1.doFilter(
        at hudson.util.PluginServletFilter.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.kohsuke.stapler.compression.CompressionFilter.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at hudson.util.CharacterEncodingFilter.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
        at org.eclipse.jetty.servlet.ServletHandler.doScope(
        at org.eclipse.jetty.server.session.SessionHandler.doScope(
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
        at org.eclipse.jetty.server.Server.handle(
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(
        at org.eclipse.jetty.server.AbstractHttpConnection.content(
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(
        at org.eclipse.jetty.http.HttpParser.parseNext(
        at org.eclipse.jetty.http.HttpParser.parseAvailable(
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(
        at winstone.BoundedExecutorService$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$
    Caused by: Unrecognized SSL message, plaintext connection?
        at com.sun.mail.util.SocketFetcher.configureSSLSocket(
        at com.sun.mail.util.SocketFetcher.getSocket(
        at com.sun.mail.smtp.SMTPTransport.openServer(
        ... 63 more

  • Jenkins Git userContent plugin
  • Docker in Docker permissions error
  • Maven with Jenkins - Update parent pom version of dependency
  • Using Jenkins Version Environment Variable in the MSBuild step
  • Custom workspace in jenkins
  • Writing jenkins plugin: where is the documentation?
  • 7 Solutions collect form web for “How to change the security type from SSL to TLS in Jenkins?”

    For Jenkins on Windows, open jenkins.xml and modify the arguments node

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

    Office 365 indeed requires authenticated SMTP with TLS. The SSL option in the Jenkins configuration does not help, leave it unchecked. Instead add the following system property to the Jenkins VM:


    For the standalone Jenkins put it in jenkins.xml from the installation folder and for Tomcat update the startup script or use tray icon on Windows.

    Then restart jenkins and you’re good to go.

    Here is what worked for me running Jenkins on CentOS. Edit /etc/sysconfig/jenkins and add the option -Dmail.smtp.starttls.enable=true to JENKINS_JAVA_OPTIONS,

    If there’s some other variable already, append -Dmail.smtp.starttls.enable=true to it, so it should be similar to the below:

    JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"

    restart Jenkins with service jenkins restart and you should be good to go

    I run Jenkins under Ubuntu Server 14.04 and I had to adapt the previous answer which addresses CentOS distribution.

    First of all, under most Linux distribution, the configuration file for Jenkins is located at /etc/default/jenkins (see this link). I use Jenkins 2.7 and I append -Dmail.smtp.starttls.enable=true to the existant setting variable JAVA_ARGS. Finally, I ended with this:

    JAVA_ARGS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"

    Thanks for the answers, I got it fixed. First of all, the JAVA supports by default only SSL. So, Jenkins Java options need to be set to enable TLS. Afterwards, start the Jenkins service. The problem of this permission issue occurs when you don’t give the System Admin e-mail address under the Jenkins location column. This doesn’t happen for gmail smtp. I guess office 365 has a high security. So, it allows only the registered user to send the emails.

    For me adding “-Dmail.smtp.starttls.enable=true” to java options didn’t work out of the box – Jenkins was trying to connect to the SMTP, but in the the logs at /var/log/maillog (CentOS 7.2) I’ve seen that the connection is established and then after some time (presumably after time out) postfix has reported “lost connection after CONNECT from {host_name}”. I have also connection through TLS. After some research I’ve decided to try different port – 587 – instead of default 465 and voila! – finally the test email was sent.

    SSL and TLS are, effectively, the same.

    Git Baby is a git and github fan, let's start git clone.