simple-java-mail icon indicating copy to clipboard operation
simple-java-mail copied to clipboard

SocketTimeoutException

Open minguotan opened this issue 3 years ago • 1 comments

Hello, there. I got the exception when testing connection with my QQ mail account. I searched google and stackoverflow but found nothing related to this.

  1. I got the SMTP safe code as password, so the account infos should be OK.
  2. I find nothing special to set up in QQ Mail
  3. I switched the account to Gmail and its password, the same happened.

So could you help me with this? Many thanks! The logs: DEBUG: setDebug: Jakarta Mail version 2.0.1 DEBUG: getProvider() returning jakarta.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle] DEBUG SMTP: need username and password for authentication DEBUG SMTP: protocolConnect returning false, host=smtp.qq.com, user=mgt, password=<null> DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp.qq.com", port 465, isSSL false DEBUG SMTP: exception reading response, THROW: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:102) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read(BufferedInputStream.java:265) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:100) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2456) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2172) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722) at jakarta.mail.Service.connect(Service.java:364) at jakarta.mail.Service.connect(Service.java:222) at jakarta.mail.Service.connect(Service.java:171) at org.simplejavamail.mailer.internal.util.TransportRunner.runOnSessionTransport(TransportRunner.java:67) at org.simplejavamail.mailer.internal.util.TransportRunner.connect(TransportRunner.java:55) at org.simplejavamail.mailer.internal.TestConnectionClosure.executeClosure(TestConnectionClosure.java:54) at org.simplejavamail.mailer.internal.AbstractProxyServerSyncingClosure.run(AbstractProxyServerSyncingClosure.java:56) at org.simplejavamail.mailer.internal.MailerImpl.testConnection(MailerImpl.java:317) at org.simplejavamail.mailer.internal.MailerImpl.testConnection(MailerImpl.java:306) at com.zhuyu.login.servlet.MailServlet.test(MailServlet.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

minguotan avatar Aug 26 '22 22:08 minguotan

I am also having this problem

idengrenme avatar Sep 06 '22 23:09 idengrenme

Also QQ?

Look I don't have much to go on here. What library version? What's your code? QQ documentation on server/port usage? Did you try with vanilla Jakarta Mail or another mailing library that would imply the issue is with Simple Java Mail?

Closing until there's actual details to work with. Assuming user error until for now. I'm happy to reopen once you provide more data.

bbottema avatar Dec 14 '22 20:12 bbottema