Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send post build notification to more than one recepient in a Jenkins pipeline

I'm setting up a Jenkins pipeline wherein I want to send post build notification to more than one receipents. i'm not able to find how to set "CC", Can someone help.

An example of my pipeline is as under:

pipeline {
    agent any
    stages {
        stage('No-op') {
            steps {
                sh 'ls'
            }
        }
    }
    post {
        failure {
        mail to: '[email protected]',
             subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
             body: "Something is wrong with ${env.BUILD_URL}"
    }
}

}

The above example is working fine for me, but i want to modify the following line to send notification to multiple people (preferably in CC):

mail to: '[email protected]',

I'm using Jenkins ver. 2.41

like image 367
Yash Avatar asked Aug 22 '17 16:08

Yash


1 Answers

I don't know if you can CC them, but to send to multiple recipients try using a comma-delimited list:

mail to: '[email protected],[email protected]',
like image 56
David Levesque Avatar answered Nov 03 '22 01:11

David Levesque