To perform email notification, we need to do a pre - setup gmail account and Jenkins.
Let's go through the pre-setup:
==> Pre Setup on Gmail
1. Turning on 'less secure apps' settings as mailbox user
- Go to your (Google Account).
- On the left navigation panel, click Security.
- On the bottom of the page, in the Less secure app access panel, click Turn on access.
If you don't see this setting, your administrator might have turned off less secure app account access (check the instruction above). - Click the Save button.
2. Turn Off two step verification
How to schedule Job in Jenkins using CRON?
==> Pre-Setup on Jenkins
- Now go to Manage Jenkins-> Configure System.
- Scroll down to the email notification section. If you are using Gmail, then type smtp.gmail.com for the SMTP server.
- Click on Advanced and select Use SMTP authentication.
- Enter your Gmail username and password.
- Select the Use SSL option and enter the port number as 465.
- Click on Apply and then Save.
After the pre-setup we need to go to the Jenkins job so that we can integrate the email notification:
Go to Job(Jenkins automation execution Job)
==> Configure
==> Post Build Actions
==> Select “Editable Email Notification” from the dropdown
==> Advanced Settings
==> Triggers
==> Add Trigger Always
==> Select “Recipient” for “Send To” option
==> Click on Advance
==> Enter the recipient email id and change the subject as per your automation suite.
How to send Email Notification from Jenkins using Groovy Script?
No comments:
Post a Comment