java mail through Proxy
843830Sep 10 2001 — edited Sep 22 2001Hi,
I am trying to send a mail using the proxy.The code is as follows:
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", hostname);
System.getProperties().put("proxyPort", portnumber);
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props,null);
Store store = session.getStore("pop3");
store.connect("pop.mail.yahoo.com",user,password);
When I run my programme,I get the Exception as:
Exception in thread "main" javax.mail.MessagingException: Connect failed;
nested exception is:
java.net.UnknownHostException: pop.mail.yahoo.com
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:106)
at javax.mail.Service.connect(Service.java:234)
at javax.mail.Service.connect(Service.java:135)
at MailYahoo.main(MailYahoo.java:19)
I am behind a firewall and access the Internet using proxy.
Please let me know what could be the possible reason for this code not working,and what needs to be done.
Thanks,
Shipra