• 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

How do I read a mail from Hotmail or yahoo

 
Greenhorn
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");
folder.open(Folder.READ_ONLY);
// 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
folder.close(false);
store.close();
}
}
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 www.hotmail.com , 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,
Parthiban.
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!