Connecting Gmail with Jenkins
Login to Jenkins with a valid username and password
Navigate to the plugins and then Download the email extension plugin from
Navigate to your Google account --> click on "manage your Google account" --> select 2-Step Verification
Now, click on the 2-Step Verification page, which looks like as shown on the page below
click on the app passwords and enter the name Jenkins in the
it will automatically generate a password here, for security reasons I have blocked it with Redbox below
In Jenkins, Navigate to Manage Jenkins --> System --> go to the end of the page of it. There you will find the Email Notification section
Enter the following details as shown below
SMTP server: smtp.gmail.com
username: your email (ex: yemail @ email.com)
password: paste the generated app password here
Use SSL: Selected
SMTP Port: 465
Charset: UTF-8
Once, these configurations are set, make sure to check the test configuration by sending a test email,
Just give the same email address mentioned above in the username section and to the right side select Test Configuration
observe that you will be receiving an email to your email account
Navigate up a bit on the same page which is Jenkins --> Manage Jenkins --> System --> Extended Email Notification
In that, if you drag down in that section, you will find, default triggers as shown below
Click on the Default Triggers
in that section, Select Always, and apply and save the page.
So, from now onwards, for every job, if it passes, fails or any state it will report an email notification to the configured email.
SMTP server: smtp.gmail.com
SMTP Port: 465
click on the Advanced
Use SSL: Selected
-
Click on the Add button as shown in the image above and then in the dropdown select Jenkins.
It will open up a dialog box of Jenkins Credentials Provider. Here mention the following details as shown below:
username: USERNAME which is already configured at the time of test configuration in the previous section
password: generated app code which is saved previously
Click on the Add button which is there in the bottom of the dialog box.
Now, select the email that was set in the credentials dropdown click on the apply and save on the manage Jenkins dashboard.
Just create a job, In the configuration of the job, navigate to the bottom of the configuration page, where you will see the post-build actions, in select Editable Email Notification
observe that there is a section called Project Recipient List
mentions the email that you have configured to work with the Jenkins. (The username that you have provided in the above)