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

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Check if ip adress is correct, if the port is correct, and if the server is up and running and waiting for connections. Also, check if there's no firewall blocking you and if your internet connection is working.


rafael
tip

Check if your MongoDB is available.


rp
tip

host port isnt set

tip

To restart the Selenium Webdriver mock browser in a testcase, first use 'driver.close()' and then reinstantiate the driver.

tip

Firewall might be blocking your connection, or MySQL it's not running on your server machine.


rafael
tip

Check if you have started your server, or if your server is set to listen to the port you're trying to connect and is waiting to accept connections and check if the firewall isn't blocking your connection.


rafael
tip

spring-data-redis requires redis 2.6+ to work properly.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • FTP client class is not connecting
    via Stack Overflow by RTA
    ,
  • Java Socket Write Error
    via Stack Overflow by user1767061
    ,
  • Java: IOException after server update
    via Stack Overflow by user1140120
    ,
  • Installing hudson slave on windows xp
    via Stack Overflow by MBU
    ,
  • how set correct hostname..
    via by gbat...@gmail.com,
    • javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 586; nested exception is: java.net.ConnectException: Connection timed out: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) at javax.mail.Service.connect(Service.java:295) at javax.mail.Service.connect(Service.java:176) at one.Chjhkj.sendEmail(Chjhkj.java:69) at one.Chjhkj.main(Chjhkj.java:22) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:321) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:237) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927)

    Users with the same issue

    ivanszkypeter
    ivanszkypeter17 times, last one,
    Casper
    Casper1 times, last one,
    Eric
    Eric1 times, last one,
    treefolk
    treefolk1 times, last one,
    Andreas Häber
    Andreas Häber9 times, last one,
    478 more bugmates