0

I'm running the windows server 2019 on Azure VM. There I've installed the Jenkins. The problem is that I can't setup an email notification there. When testing the mail configuration in Manage Jenkins -> Configure System it always fails. Later I want to send mails using Jenkins pipeline.

I've also tested more mail providers (like 5 or so). Tried to setup an outbound rule in firewall settings for the port 465 and 587, too.

gmail smtp example

I've got the security option to allow less secure access enabled and the 2-step authentication disabled in the sender gmail account.

outlook smtp example

Could you help to find a solution? (either on the VM setup or anything different) Btw. I cannot setup my own smtp server on that machine because of my Azure subscription, it is blocked by Azure.

xbalaj
  • 977
  • 1
  • 8
  • 14

1 Answers1

0

I've run into the same issue.

You probably need to enable the use of STARTTLS in your startup configuration (and uncheck Use SSL).

-Dmail.smtp.starttls.enable=true

Add this configuration parameter to the startup file (for a Windows service it is located in the jenkins.xml file).

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

I've also experimented using the -Dmail.smtps.ssl.protocols=TLSv1.2, but I'm not sure if it is really needed for outlook.com (https://www.appliedis.com/how-to-enable-tlsv1-2-in-jenkins-for-smtp/).

See also this answer: https://stackoverflow.com/a/24309128/3433642 and this blog post https://hasithaqa.wordpress.com/2019/03/24/how-to-send-e-mails-using-office365-mail-account-from-jenkins/

The other issue is, that currently (in version 1.24 from 29.07.19 of the Mailer Plugin) the "Test configuration" for SMTP authentication is broken. The "Test configuration" does not correctly recognize the "Use SMTP authentication" checkbox. But Jenkins uses the credentials when sending a Mail notification. So if it is configured correctly it should work regardless of the "Test configuration".

A fix for this is proposed in https://github.com/jenkinsci/mailer-plugin/pull/60.

Tommy
  • 1
  • 2