Sending Mail using Jenkins Plugin (Linux based)

This article will guide you on how to send email using the plugins available in Jenkins. I will be using Gmail as the mail server here.

Settings to be done Google Account settings

Also, make sure, 2 Step Verification is switched off.

Now, moving on to Jenkins and configuring it.

  1. Installing the required plugins.

** Every plugin installed has its own use cases. The main plugin is marked in red.

2. Changes in the Jenkins configuration file

Open /etc/sysconfig/jenkins and edit JENKINS_JAVA_OPTIONS as follows ::

JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true -Dmail.smtp.ssl.protocols=TLSv1.2"

and restart Jenkins service

sudo service jenkins restart

3. Configuring the plugin

** TLS is the successor of SSL so we will be using it here.

** All the plugins need to be configured separately. I will be showing you a basic setup of one of the plugins and the same can be followed for all.

If using SSL instead of TLS, then use port 465.

Please make sure either your firewall is off or the ports are allowed through firewalld.

SMTP Server: Server to be used for mailing service. I have used the Gmail server. You can set your accordingly.

Reply-to-address: If you don’t want any queries on the server mail, then provide this so any reply to this mail will go to that email id.

Verifying the configuration

Tested and running successfully.

4. Using the plugins

These plugins can be found in post-build actions and can be used as per the requirement. For example, E-mail notification gives you just two options i.e. sending mail for unstable builds and emails to the devs who broke the build. Recipients can be set accordingly.

The other two notification plugins provide more elaborate features.

I hope this helped. You can appreciate by giving us an applaud.

Worked in collaboration with Daksh Jain.

Connect me on my LinkedIn as well.

--

--

--

LinuxWorld Informatics Pvt. Ltd.(‘LW’) is a fast-growing ISO 9001:2008 Certified Organisation, Fully governed by young & energetic technocrats, dedicated to Linux, Security & Open Source Technology…

Recommended from Medium

Quotes only programmers will get

What are the Triggers in SQL?

How To Override Stubborn CSS

Sinatra who???

Solution for NVM “Access is denied” Error

Build and test your program using Gitlab Pipeline

Automatically Analyze and Validate Your Software Design

Creating modular systems with Switch

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ashish Kumar

Ashish Kumar

Just a tech enthusiast… Research, implement and share is what I like to do

More from Medium

Check container vulnerability with Snyk in CI/CD pipeline using Jenkins

Bamboo vs Jenkins: Showdown Of CI/CD Tools

Importance of Jenkins —

Jenkins Declarative Pipeline Essentials