13

Hi I have the following email configuaration for my jenkins. I can't get it to test the configuration for email

SMTP SERVER: smtp.gmail.com

Default user e-mail suffix: @gmail.com

Use SMTP Authentication: checked

username: "my full gmail id:

password: "my gmail id password"

Use SSL: Checked

SMTP Port: 465

reply to address: [email protected]

Charset: UTF8

Test email recipient: "my full email id"

Can someone tell me why i still get the following error when i test configuration. I am using a windows 8 machine and tomcat as my server

Failed to send out e-mail

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested exception is:
java.net.ConnectException: Connection timed out: connect

at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)

at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638
1

7 Answers 7

8

Your exception says, that there is no SMTP server on 465 port

Uncheck SSL and use post 587

5

The main problem is that Google has deactivated this feature with your account password to gain more security. If you want to use your google, you should do the following:

  • Turn on Two-step authentication from your google account settings
  • Generate an "application password"
  • Use your account and the generated app password as Jenkins SMTP Authentication

  • Do NOT fill SMTP Port !

2

I guess your are facing the same problem as I do.

I have searched around, and finally, it is the mcafee, which blocked the connection.

You may using some other antivirus software, may also cause the same issue. So, check it, edit the trust center or something similar.

For me, I just get mcafee removed -- this is also not a easy work. I really really hate mcafee !

2

Give your full gmail id at "System Admin e-mail address" under Manage Jenkins -> configurations.

This might help as well.

https://www.safaribooksonline.com/library/view/jenkins-the-definitive/9781449311155/ch04s08.html

0
1

I couldn't get Jenkins to send email from my Windows machine. It turned out that McAfee was blocking the emails. This is what I did to solve the problem:
- Right click on "McAfee”
- Select ”VirusScanConsole…”
- Right click on ”Access Protection” and select ”Properties”
- Select “Anti-virus Standard Protection”
- Edit “Prevent mass mailing worms from sending mail”
- Add the following to the list of “Processes to exclude:”
* java.exe, java.exe :::,

The key is to add java rather than jenkins.

1
  • Spot on, this was the solution for my case too!
    – Saikat
    Jan 31, 2018 at 7:21
0

I found two reasons causing the timeout and have my emails working now. First I was on my office LAN. Second I was using a free email service for testing.

1) Just to test, I got off of my office LAN by using my Mobile Internet instead. You can get around this by setting an exception in your firewall and/or System Protection software (eg. system center endpoint protection), if you have the privileges on your machine. if you must use Jenkins in Enterprise networks.

2) If you are using free email services like yahoo or gmail for just testing out Jenkins notification facility, make sure to enable support for less secure apps (https://www.google.com/settings/security/lesssecureapps) as this also prevents Jenkins from sending mail notifications. Yahoo must have similar link to turn on support for less secure apps.

After the above two steps, I could now get all notifications from my test PC on which I've configured Jenkins!! Hope this helps!

0

I had the same issue and it was my Avast antivirus which was causing this error. For Avast users, go to Protection section and click on Core shields, click on Mail Shield and disable scan outbound emails(SMTP) and then you are good to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.