This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:284)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672)
... 38 more
Mehul Kumbhani wrote:No I am using netbeans and java mail API.
Actually, I think that was a suggestion that you try telnet.
Many ISPs don't allow machines connected to their network to make an outgoing TCP connection on port 25 as a spam reduction effort.
Mehul Kumbhani
Greenhorn
Joined: Apr 24, 2010
Posts: 9
posted
0
Thanks for your kindly reply,
But sir i hava not knowledge of how to use telnet from java and netbeans,
can you suggest me.
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
Mehul Kumbhani wrote:Thanks for your kindly reply,
But sir i hava not knowledge of how to use telnet from java and netbeans,
can you suggest me.
No, telnet is a utility application that comes with most operating systems. Assuming you're using Windows, go to Start -> Run, then enter telnet.exe smtp.gmail.com 25 and hit return. If you get a hello message from the SMTP server, then you are ale to connect. To get out, just type quit and hit return.
If, however, it hangs or gives you a connection refused error, then you are not able to connect.
I'm thinking that the telnet suggestion was not clear to the original poster, so I would like to elaborate just a bit.
The point is to debug the problem and see if the issue is with your use of the JavaMail API, or if you have a general TCP/IP connectivity issue.
The telnet application can be used to see if you are able to connect to the host/port via TCP/IP. If this doesn't work, no API which uses TCP/IP (such as Java Mail) will work either. No sense debugging Java Mail if you cannot get TCP/IP connectivity working.
I hope this make it clearer.
Were you able to connect to the GMail SMTP server host using telnet?
Mark E Hansen wrote:Were you able to connect to the GMail SMTP server host using telnet?
The answer to that question is going to be "no". Gmail doesn't use unsecured e-mail connections so it won't be listening at port 25.
And if you follow the JavaEnterpriseEditionFaq link and search for "gmail" you will find a link to what the JavaMail FAQ itself has to say about Gmail. Unfortunately, if you don't understand how e-mail works and how TCP/IP networking works, you're going to have a lot of trouble making your e-mail programs work when you have networking problems. As Mark said, no amount of looking at the code is going to help if the configuration isn't right.