Open In App

How To Send Email Notification Using Jenkins ?

Last Updated : 07 May, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Jenkins notifications function as messages or alerts that notify users of significant occurrences, conditions, or modifications in CI/CD pipelines. They are essential in guaranteeing transparency and visibility throughout the development process and informing stakeholders. By following the below steps, we can configure the Jenkins notifications.

Why do we need email notifications in Jenkins?

  • Real-time Feedback: Notifications allow teams to quickly handle any type of problem or failure by giving them real-time feedback on the state of builds, tests, and deployments.
  • Collaboration: By informing team members, stakeholders, and pertinent parties about pipeline activities, progress, and outcomes, notifications promote collaboration.
  • Transparency: Notifications facilitate accountability and trust by providing easy access to results and pipeline status updates for all parties involved.
  • Rapid Response: Teams can respond quickly to key events, such as failed builds or broken tests, with timely notifications, reducing downtime and speeding up issue resolution.
  • Continuous Improvement: Teams can find areas for improvement, streamline procedures, and improve overall effectiveness and efficiency by getting updates on pipeline performance and outcomes.

Step-by-step instructions for Jenkins Notifications

Step 1: Install Jenkins

Step 2: Login to your Gmail

Step 3: Click on manage Jenkins click on security and enable 2-factor authentication, as shown image below.

Gamil Security

Step 4: Aftre enabling the 2factor authentication we need to generate app password. Under the 2 step verification we have one option app password. Click on app password as shown image below.

2-Step Verification

Step 5: Enter the name of app password, Below image refers we have entered the “Jenkins1” name then click on create. It will display the app password note it down the app password some secret place. It’s one time visible keep it mind. By using the app password we can enable the third party apps into gmail.

App Passwords

Step 6: Entetr into jenkins and click on manage jenkins then click on system and scrolle down below you will find the E-mail notification section. Here you need to configure the some settings as shown image below. Afert configuring the smtp server click on advanced section then fill the below details.

  • SMTP server: smtp.gmail.com
  • User Name: <Your mail id>
  • Paassword: <App paaword generated on step >
  • Use SSL: < Select >
  • SMTP Port <465>

Email Notification

Step 7: Scrole down below you will find the test configuration settings here you can enter the mail then click on test you will receive the test mail. Refer the below image for you refrerance.

Test Email Configuration

Step 8: After successfully receiving the test mail find the extended e-mial notification section on same page. We need to configure the below details.

  • SMTP Server: smtp.gmail.com
  • SMTP Port: 465

Extended E-mail Notification

Step 9: After step8 click on advanced then configure the credentials of your Gmail as shown image below. Then select the your credentias and click on SSL.

Gmail Credentails

Step 10: Crete the pipeline job here we have created the jenkins-notification job as shown image below. What is jenkins pipeline.

Jenkins Job

Step 11: Add post-build action in your project: To allow your projects to send an email, you need to add Post Build Action and select “Email Notification from the drop-down list. This will provide you the below interface, where you can add a list of email addresses that the email is required to be sent to.

Post Build Actions

Step 12: After success fully configuring the jenkins job you can build the jenkins job here you can refer the below image the after build success notification was send to respective mail.

Console Output

Step 13: Refre the below image you will find the jenkins notification mail. We will get the notifications successful or failure of build or we can customize the notifications as per our requirements. We can find the customization settings on extendable email notification settings.

Gmail Notification

Conclusion

Jenkins email notifications are essential for giving real-time feedback, encouraging teamwork, maintaining transparency, enabling quick responses to important events, and supporting pipelines for continuous integration and delivery of continuous improvement. Through adherence to the above-described, methodical methods, users can efficiently set up email notifications, augmenting correspondence and optimizing workflow administration in their Jenkins environment.

Jenkins Notifications – FAQ’s

What is Jenkins notification?

Jenkins notification is a feature that allows users to receive real-time feedback and collaboration by sending them messages or alerts about important events or changes in CI/CD pipelines.

Can Jenkins send SMS?

It is possible for Jenkins to deliver SMS notifications with plugins like Clickatell or Twilio, giving users the ability to get alerts and updates straight from their pipelines.

How do I start Jenkins?

Go to the Jenkins installation directory and type “java -jar jenkins.war” into the terminal or command line to launch Jenkins. Alternatively, if Jenkins is set up as a service, you can launch it with the relevant operating system service management commands.

How do I delete a job in Jenkins?

In Jenkins, to remove a job, go to the job page, select “Delete Project” from the sidebar menu, and then click “Confirm Delete.” Another option is to erase the job straight from the Jenkins file system.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads