What if we want to send a notification of the build status from Jenkins? We can configure mail notifications in such scenarios.
If a Gmail account is configured with two-factor authentication, then the following process can help to setup notification systems:
- Go to
Less secure apps
in the Google account. - Click on
Learn More
in the second paragraph where two-factor authentication is mentioned:
- Click on the
App Password
page:
- Provide a name and click on
Generate
:
- Copy the password:
- Go to
Manage Jenkins
and click onConfigure system
. - Go to the
Email notification
section.
- Provide all required details and in the password field, copy the recently generated password for the Jenkins app.
- Click on
Test configuration
:
- Go to the
PetClinic-Code
job and selectE-mail
notification from thePost build action
:
- Execute the Jenkins job and if it fails, go to the console output and verify the output:
- Go to your inbox and verify the mail sent by Jenkins:
Done!