Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-23598

Expose a few more (crucial) SMTP properties

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • mailer-plugin
    • Ubuntu 13.10 x64
      Jenkins 1.554.2
      Mailer 1.8

      Hi,

      Office 365 servers are notorious for their slow responses. Recently I get a lot of these:

      ERROR: Could not connect to SMTP host: podxxxxx.outlook.com, port: 587
      javax.mail.MessagingException: Could not connect to SMTP host: podxxxxx.outlook.com, port: 587;
      nested exception is:
      java.net.SocketTimeoutException: connect timed out
      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.MailSender.execute(MailSender.java:117)
      at hudson.tasks.Mailer.perform(Mailer.java:137)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
      at hudson.model.Build$BuildExecution.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
      at hudson.model.Run.execute(Run.java:1709)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:231)
      Caused by: java.net.SocketTimeoutException: connect timed out
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:579)
      at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)
      at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
      at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)
      ... 17 more
      Finished: FAILURE

      So now I'd like to increase the SMTP timeout value but apparently that's not possible as of now.

      Another ugly problem is that Office 365 uses STARTTLS without SMTPS so to make mailer work I gotta hack on /etc/default/jenkins and add -Dmail.smtp.starttls.enable=true to JAVA_ARGS otherwise it won't work. (Hmm, come to think of it, timeout might also be set this way, too...)

      So all I ask for is to expose the mail.smtp.connectiontimeout, mail.smtp.timeout and mail.smtp.starttls.enable properties under settings instead of always using the Java defaults.

      Thanks in advance!

      Viktor

            Unassigned Unassigned
            bviktor Viktor Berke
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: