com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1; 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:345) at javax.mail.Service.connect(Service.java:226) at gmailYeni.SendMail.sendFromGMail(SendMail.java:52) at gmailYeni.SendMail.main(SendMail.java:20) `Caused by: java.net.ConnectException: Connection timed out: connect

tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    MailConnectException in Java

    Stack Overflow | 3 years ago | Batuhan Bardak
    com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1; 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:345) at javax.mail.Service.connect(Service.java:226) at gmailYeni.SendMail.sendFromGMail(SendMail.java:52) at gmailYeni.SendMail.main(SendMail.java:20) `Caused by: java.net.ConnectException: Connection timed out: connect
  2. 0

    Mail error

    GitHub | 2 years ago | manjoel
    com.sun.mail.util.MailConnectException: Couldn't connect to host, port: mail.tango.lu, 25; timeout -1;| nested exception is:|?java.net.ConnectException: Die Wartezeit für die Verbindung ist abgelaufen

    Root Cause Analysis

    1. com.sun.mail.util.MailConnectException

      Couldn't connect to host, port: smtp.gmail.com, 587; timeout -1; 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:345) at javax.mail.Service.connect(Service.java:226) at gmailYeni.SendMail.sendFromGMail(SendMail.java:52) at gmailYeni.SendMail.main(SendMail.java:20) `Caused by: java.net.ConnectException: Connection timed out: connect

      at java.net.TwoStacksPlainSocketImpl.socketConnect()
    2. Java RT
      Socket.connect
      1. java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
      2. java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
      3. java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
      4. java.net.AbstractPlainSocketImpl.connect(Unknown Source)
      5. java.net.PlainSocketImpl.connect(Unknown Source)
      6. java.net.SocksSocketImpl.connect(Unknown Source)
      7. java.net.Socket.connect(Unknown Source)
      8. java.net.Socket.connect(Unknown Source)
      8 frames
    3. JavaMail API (compat)
      SMTPTransport.openServer
      1. com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:297)
      2. com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:229)
      3. com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927)
      3 frames