Configuring Email Server in Jenkins using SMTP gmail

We will use the plugin named Email Extension Plugin to trigger our emails. Go to Manage Jenkins -> Manage Plugins -> Search for Email Extension Plugin -> Install.

With this plugin you can customize things such as when to send the email, who receives it, and what the email says.

Go to Manage Jenkins -> Configure System -> You will find a Email Notification tab. We need to fill in the details here.

  1. Select Advanced.
  2. SMTP Server :
  3. Select Use SMTP Authentication
  4. Username : Your gmail Id
  5. Password : Your gmail password
  6. Select Use SSL
  7. SMTP Port : 465
  8. Reply-to-Address : your email id
  9. Charset : UTF-8
  10. Save

Screenshot below for the above configuration :

Yeah. So we are using smtp protocol to send/receive messages : The Simple Mail Transfer Protocol (SMTP) is an internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages.

It should be no surprise to know that google provides a widely popular webmail i.e. Gmail and also an associated outgoing mail server which can be used to work with emails. To use smtp google you just need server, port, email id and password. Server and port remains same and 465 respectively. Email id and password will change based on the account you want to use to run this server.

Now we are ready to use the mail server to send & receive emails in the Jenkins pipeline.

You may get errors while trying to use your gmail account. You need to provide third party applications access so that Jenkins can use your account as smtp server. This stackoverflow link helped me resolve the issue related to turning off two step verification and allowing less secure application to be used.

Screenshot example to use email in Jenkins pipeline :

In the above screenshot, if there’s any failure in unit test stage then an email will be sent to ‘’ with the subject and body provided.

With that, we have setup a mail server in Jenkins pipeline. Please follow me to get more interesting and real tech content.

Happy learning. Cheers!



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