-
Bug
-
Resolution: Fixed
-
Minor
-
Jenkins lts version 2.164.3
email-ext 2.66
configuration-as-code:1.15
configuration-as-code-support:1.15
-
-
2.73
Configuring the email-ext plugin using the CasC plugin, the smtpHost is ignored when also setting the smtpUsername / smtpPassword authentication fields.
The Email Extension plugin can be set up 'hands on' in the UI, so using the necessary fields described in the CasC documentation, I set up something like this:
extendedEmailPublisher: smtpServer: smtp.server.com smtpUsername: alerts@company.com smtpPassword: ${SMTPpass} useSsl: true charset: UTF-8 defaultContentType: text/plain defaultSubject: "Build $BUILD_NUMBER - $BUILD_STATUS" defaultBody: "Check console output at $BUILD_URL"
But adding the smtpUsername / smtpPassword fields seems to cause the 'smtpServer' value to be ignored completely (it's not ignored when the smtpUsername / smtpPassword fields are not present). Instead, the 'smtpHost' value from the Mailer plugin configuration is used in its place
In order to get SMTP authentication working for the Email Extension plugin, I used this setup:
mailer: smtpHost: smtp.server.com useSsl: true charset: UTF-8 extendedEmailPublisher: smtpUsername: alerts@company.com smtpPassword: ${SMTPpass} defaultContentType: text/plain defaultSubject: "Build $BUILD_NUMBER - $BUILD_STATUS" defaultBody: "Check console output at $BUILD_URL"
It's not ideal that part of the configuration lives in each plugin though (the mailer plugin does not support SMTP auth fields - JENKINS-55109)
See also: https://github.com/jenkinsci/configuration-as-code-plugin/issues/772
You could try adding a field like this:
extendedEmailPublisher: overrideGlobalSettings: true