即使成功连接到主机后,我仍然遇到以下错误: ................................................... ...........................
DEBUG: setDebug: JavaMail version 1.5.5
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: need username and password for authentication
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.mail.yahoo.com", port 587, isSSL false
220 smtp.mail.yahoo.com ESMTP ready
DEBUG SMTP: connected to host "smtp.mail.yahoo.com", port: 587
DEBUG SMTP: exception reading response, THROW:
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:124)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:92)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2331)
at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:1620)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:703)
................................................................................
I am using javamail 1.5.5 jar. I took the code from github https://github.com/FoulerBenny/SampleProject/blob/master/src/main/java/com/genericLibraries/EmailAttachmentSender.java
我的意图是使用SSL,但是首先尝试这种方式,因为SSL花费的时间太长了 。