Jenkins Pipeline Email Notification
Fork me on GitHub

All Tags:

mindset

devops

book

ci

communication

jenkins

自媒体

hometown

tools

tool

cloud

 

Labs: Jenkins Pipeline Email Notification

Assume the Jenkins Server URL is “http://192.168.0.1:8080”.

Configure Email Notification

Navigate to {jenkins-server-url}/configure and scroll down to “E-mail Notification”.

Email SMTP Setting

Troubleshooting

Pipeline Syntax to send email


  post {
      unsuccessful {
            echo 'Pipeline is unsuccessful!'
            emailext(subject: "Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' ",
            body: "Job '<${env.BUILD_URL}>' Unsuccessful.",
            from: '******@gmail.com',to: '******@outlook.com')
      }

      always {
            echo 'Pipeline Completed!'
      }

}