How to send mail notification about build failure in jenkins.. with example

Опубликовано: 30 Май 2026
на канале: Chalkpiece
751
6

Here I have used,
Plugin: Jenkins Mailer Plugin
Mail: Gmail
Code to be added in your Jenkinsfile:
post {

failure {
echo 'sending email notification from jenkins'

step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'],
[$class: 'RequesterRecipientProvider']])])


}