This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I read a mail from Hotmail or yahoo  RSS feed

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,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!