Click here to Skip to main content
15,031,223 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
using javamail program,how to read inbox of my AOL account..
Posted

Repost of question about reading from GMX account.
   
Finally i developed the code in jsp..and its working well..all is well..


XML
<%! String host,username,password;%>


<%!Store store;%>
  <%!Folder folder;%>

<%
 host="pop.aol.com";
 username="username@aol.com";
 password="password";

Properties props = new Properties();


Session mailsession = Session.getDefaultInstance(props, null);


store = mailsession.getStore("pop3");
store.connect(host, username, password);

folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);


Message message[] = folder.getMessages();

int count=folder.getMessageCount();
out.print(count);

for (int i=0, n=message.length; i<n; i++) {
   out.println(i + ": " + message[i].getFrom()[0]
     + "\t" + message[i].getSubject());
}


// Close connection
folder.close(false);
store.close();
%>
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900