Saturday, February 25, 2017

Jenkins - Email Configuration (Example- Gmail)

We always struggle to configure our Email (either Personal/Office) with Jenkins. This article will help you to come out from that problem. I have taken "Gmail-Configuration" as example in this demonstration since Gmail is widely used.

First change the setting in Gmail to access less secure applications:- 
  • ·         Login to your Gmail account with valid credentials
  • ·         Navigate to "https://myaccount.google.com/security" url
  • ·         Enable "Allow less secure apps" option as shown in the below diagram 

Install Email-ext plugin:-
  • ·         Install Email-ext plugin at plug-in install page of Jenkins 

Configure System: - (Manage Jenkins > Configure System)
  • ·         Make sure you have logged into Jenkins as admin
  • ·         In Extended E-mail Notification section
  • ·         Enter your SMTP server name to “SMTP server”
    •  In case of Gmail – smtp.gmail.com
  • ·          Enter “Default user E-mail suffix
    • In case of Gmail – @gmail.com
  • ·         Click “Advanced”
  • ·         Click “Use SMTP Authentication”
  • ·         Enter required information(Gmail-Username & Password)
  • ·         Check “Test configuration by sending test e-mail”
  • ·         Click “Test configuration” to send test email
  • ·         Click “Save” in the bottom of the page

Configure a project to send email at every build:-
  • ·         Click “Add post-build action”
  • ·         Click “Editable Email Notification”
  • ·         Click “Advanced Settings…”
  • ·         Click “Add Trigger”
  • ·         Click “Always”
  • ·         Save 
Run your Test:-
  • ·         Click “Build Now” / “Build with Parameters” as per your requirement
  • ·         Check Console output and received email as shown below


No comments: