com.sun.mail.util.MailConnectException

Couldn’t connect to host, port: host, 25; timeout -1; nested exception is: java.net.UnknownHostException: host

Samebug tips1

Check if you don't have a VPN or something like this messing with your connection. Also, check Jenkins DNS configurations (try to start it with "--dns 8.8.8.8".

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web21

  • via howtodoinjava.com by Unknown author, 9 months ago
    Couldn’t connect to host, port: host, 25; timeout -1; nested exception is: java.net.UnknownHostException: host
  • via Coderanch by Neha Sud, 2 months ago
    Couldn't connect to host, port: 172.31.1.6:8090, 25; timeout -1; nested exception is: java.net.UnknownHostException: 172.31.1.6:8090
  • via journaldev.com by Unknown author, 6 months ago
    Couldn’t connect to host, port: smtp.gmail.com, 587; timeout -1; nested exception is: java.net.ConnectException: Connection timed out: connect
  • Stack trace

    • com.sun.mail.util.MailConnectException: Couldn’t connect to host, port: host, 25; timeout -1; nested exception is: java.net.UnknownHostException: host at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1984) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:656) at javax.mail.Service.connect(Service.java:345) at javax.mail.Service.connect(Service.java:226) at maina.MainA.sendMail(MainA.java:92) at maina.MainA.main(MainA.java:32) Caused by: java.net.UnknownHostException: host at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:158) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:154) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:380) at java.net.Socket.connect(Socket.java:569) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:569) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:301) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:208) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1950)

    Write tip

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

    Users with the same issue

    Once, 2 months ago
    10 times, 3 months ago
    Unknown user
    Once, 9 months ago
    3 times, 10 months ago
    Unknown user
    Once, 11 months ago
    113 more bugmates