I tried to configure jenkins to send email notification with gmail as the POP provider but I could not succeed
SMTP server - pop.gmail.com
Default user e-mail suffix - @gmail.com
Sender E-mail Address - Foobar CI <your.email@gmail.com>
Use SMTP Authentication - yes
User Name - your.email
Password - p******d
Use SSL - yes
SMTP Port - 995
Reply-To Address - noreply@gmail.com
Charset - UTF-8
Test failed with : Connection refused
javax.mail.MessagingException: Could not connect to SMTP host: pop.gmail.com, port: 995; nested exception is: java.net.ConnectException: Connection refused: connect
The following screenshot illustrates the e-mail configuration you'd need to do to send e-mails from GMail.
I successfully did this with Zapier on their free tier (without having to turn on "less secure apps" in gmail
PS. I have no reason to recommend Zapier other than that it is working for me, and there's a solution w/o comprimising my gmail account.
The above configuration didn't work because of added security measures by google. An additional configuration is required in the Gmail account from which the mail is being triggered. This step authorizes apps like Jenkins to use the Gmail account.
https://support.google.com/accounts/answer/6010255
Go to the "Less secure apps" section in My Account. Next to "Access for less secure apps," select Turn on. (Note to G Suite users: This setting is hidden if your administrator has locked less secure app account access.)
After this emails were triggered successfully.
Below are the updated gmail SMTP server configuration :
This configuration is working fine for me .
The hostname for the Google SMTP server is smtp.gmail.com and if you use SSL, then the correct Port is 465.
A POP server is usually just for receiving mails, not sending mails.
Obtain application specific password
sing-in to gmail account >> navigate to settings >> privacy and security settings
setup two step verification settings (because without two step verification we cannot generate application specific password)
after setting up two step verification setting in gmail account navigate back to security and privacy settings
click on application specific password >> give the name of the application in the drop down as Jenkins (google by default does not have any specific application password setting for Jenkins) >> this will generate password note down the password generated
Note : Since the Password has a overall control over you gmail account disclosing it may lead serious consequences
Setup SMTP configuration for sending the gmail
navigate in the following path from dashboard after logging in manage
Jenkins
>>configure system
>>scroll down to email notification section
enter the following parameters
select advanced
check smtp authentication
check use SSL
select Test configuration mail
click on test configuration which will send a test mail to the recipient e-mail id