Process Flow - Email notification plugin
Job starts
Build runs
Build finishes
Check build result
Send email
End
The Jenkins job runs a build, then depending on success or failure, it triggers the email notification plugin to send an email.
pipeline {
agent any
stages {
stage('Build') {
steps { echo 'Building...' }
}
}
post {
success { mail to: 'team@example.com', subject: 'Build Success', body: 'Good job!' }
failure { mail to: 'team@example.com', subject: 'Build Failed', body: 'Please check.' }
}
}| Step | Build Status | Condition Checked | Email Sent | Email Subject |
|---|---|---|---|---|
| 1 | Running | N/A | No | N/A |
| 2 | Success | Success? | Yes | Build Success |
| 3 | Success | Failure? | No | N/A |
| 4 | End | N/A | N/A | N/A |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|---|
| buildStatus | N/A | Running | Success | Success | Success |
| emailSent | No | No | Yes | Yes | Yes |
| emailSubject | N/A | N/A | Build Success | Build Success | Build Success |
Jenkins Email Notification Plugin: - Sends emails after build completion. - Use 'post' block in pipeline for success/failure. - 'mail' step sends email with to, subject, body. - Emails reflect final build status only. - Helps team stay informed automatically.