Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger
  • Frits Walraven

How do I read a mail from Hotmail or yahoo

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Is there anyone to help me with this code.I took this code from one book.
import javax.mail.*;
import javax.mail.internet.*;
public class GetListExample {
public static void main (String args[]) throws Exception {
String host = args[0];
String username = args[1];
String password = args[2];
// Get session
Session session = Session.getInstance(
System.getProperties(), null);
// Get the store
Store store = session.getStore("pop3");
store.connect(host, username, password);
// Get folder
Folder folder = store.getFolder("INBOX");;
// Get directory
Message message[] = folder.getMessages();
for (int i=0, n=message.length; i<n; i++) {>
System.out.println(i + ": " + message[i].getFrom()[0]
+ "\t" + message[i].getSubject());
// Close connection
The below code is compiling perfectly. It takes three i/p parameters like hostname, user and password. Here which hostname to give . I tried giving , one username and password . I am getting an error saying that Connect failed and NoRouteToHostException.
Is there anything else I should do to read a mail in hotmail through my program. I am inside a proxy server . Could u also tell me how I should give the hostname. I would be thankful if anyone could give me the response at the earliest. My company uses MSExchange Server 5.5. I was not able to connect to it . To which I found out that a patch should be installed in the server.

Thanks in Advance,
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
    Bookmark Topic Watch Topic
  • New Topic