Home > Back-end >  By mail. The jar crawl email times wrong Connection timed out: connect
By mail. The jar crawl email times wrong Connection timed out: connect

Time:01-09

String host="app. Mail";
String username="[email protected]";
String password="123456";

The Properties props=new Properties ();
The Session Session=Session. GetDefaultInstance (props, null);

Store Store=session. GetStore (" imap ");
Store. Connect (host, username, password);

Folder Folder=store. GetFolder (" INBOX ");
Folder. Open (folder. READ_ONLY);
The Message the Message []=folder. The getMessages ();
System. The out. Println (" number of mail: "+ message. Length);
ShowMail re=null;
The Exception in the thread "main" javax.mail. Mail. MessagingException: Connection timed out: connect;
Nested exception is:
Java.net.ConnectException: Connection timed out: connect
At com. Sun. Mail. Imap. IMAPStore. ProtocolConnect (IMAPStore. Java: 670)
The at javax.mail. Mail. Service. The connect (Service. Java: 295)
The at javax.mail. Mail. Service. The connect (Service. Java: 176)
At the test. The main (test. Java: 21)
Under Caused by: java.net.ConnectException: Connection timed out: connect
The at java.net.DualStackPlainSocketImpl.connect0 (Native Method)
The at java.net.DualStackPlainSocketImpl.socketConnect (Unknown Source)
The at java.net.AbstractPlainSocketImpl.doConnect (Unknown Source)
The at java.net.AbstractPlainSocketImpl.connectToAddress (Unknown Source)
The at java.net.AbstractPlainSocketImpl.connect (Unknown Source)
The at java.net.PlainSocketImpl.connect (Unknown Source)
The at java.net.SocksSocketImpl.connect (Unknown Source)
The at java.net.Socket.connect (Unknown Source)
The 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. Iap. Protocol. & lt; init> (116) Protocol. Java:
At com. Sun. Mail. Imap. Protocol. IMAPProtocol. & lt; init> (IMAPProtocol. Java: 115)
At com. Sun. Mail. Imap. IMAPStore. NewIMAPProtocol (IMAPStore. Java: 685)
At com. Sun. Mail. Imap. IMAPStore. ProtocolConnect (IMAPStore. Java: 636)
. 3 more
My test is a network of 163 I had a test can is such a great god help Intranet

CodePudding user response:

Your problem solved? Meet the same problem

CodePudding user response:

Isn't Intranet do what restrictions, lead to can't access
  • Related