Jenkins pipeline emailext emailextrecipients: Can I also add specific, individual email address?
I don't know how I missed this, but the answer is in the email-ext doc. Use the to:
for the additional email addresses, and use recipientProviders:
instead of to: emailextrecipients
. So one would have:
emailext (
subject: email_subject,
mimetype: 'text/html',
to: '[email protected]',
recipientProviders: [[$class: 'CulpritsRecipientProvider'],[$class: 'RequesterRecipientProvider']],
body: email_body
)
A slight variation to Generic Ratzlaugh's answer, in case you need to use conditional logic for email destinations.
def myProviders = [ [$class: 'CulpritsRecipientProvider'], [$class: 'DevelopersRecipientProvider'] ];
myProviders.add ( [$class: 'RequesterRecipientProvider'] );
emailext (
subject: email_subject,
mimetype: 'text/html',
to: '[email protected]',
recipientProviders: myProviders,
body: email_body
)