Reading Mails in JavaMail API

Hi,

i need to read my inbox from my gmail account.

i have given the following configuration parameters in my program inside a hashtable.

Hashtable hashObj =new Hashtable();

hashObj.put("host","pop.gmail.com");

hashObj.put("user","nb123@gmail.com");

hashObj.put("pswd","password");

but i am getting the following error::

javax.mail.MessagingException: Connect failed;

nested exception is:

java.net.ConnectException: Connection timed out: connect

at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:148)

at javax.mail.Service.connect(Service.java:275)

at javax.mail.Service.connect(Service.java:156)

at ReadEmailClient.ReadEmail(ReadEmailClient.java:35)

at ReadEmailClient.main(ReadEmailClient.java:83)

Caused by: java.net.ConnectException: Connection timed out: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(Unknown Source)

at java.net.PlainSocketImpl.connectToAddress(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)

at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)

at com.sun.mail.pop3.Protocol.<init>(Protocol.java:81)

at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:201)

at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:144)

... 4 more

[1848 byte] By [nb123a] at [2007-11-26 15:06:32]
# 1
try to ping pop.gmail.com and see if you can reach the host. if not, it might be a firewall inbetween.
khookha at 2007-7-8 8:56:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
How do i read my inbox only in gmail.By default it is reading the ALL mail folder.Please help me out.
nb123a at 2007-7-8 8:56:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

Hello!

Did you already find why you received that exception when trying to connect to pop.gmail.com?

I'm having the same problem. I can ping pop.gmail.com but I can't telnet it using port 995 (as gmail sais) or port 110 (pop3 default port).

I guess it's not a problem of my code, right? I'm using code from the following link:

http://www.java-tips.org/other-api-tips/javamail/connecting-gmail-using-pop3-connection-with-ssl-2.html

Can you please give me some ideas to solve that.

Greetings,

Filipe

filipea at 2007-7-8 8:56:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
Right, it's not your code, it's your firewall.Reconfigure your firewall to allow the connection.
bshannona at 2007-7-8 8:56:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
It's posible to use gmail in Outlook so the problem might not be in the firewall, right?
filipea at 2007-7-8 8:56:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
If you have a firewall running on your machine (as opposed toelsewhere on the network) it might be configured to allow Outlookto access gmail, but might not be configured to allow other programsto access gmail.
bshannona at 2007-7-8 8:56:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...