02-07-2013 07:37 AM
hi , what code do i use to read all the emails the user has recieved.
i know how to add a folder listener to read all new messages recieved but how do i read the older ones.
for example a message was recieved before the user launches the app.
thanx
Solved! Go to Solution.
02-07-2013 08:48 AM
Try the last few lines from this KB article:
02-07-2013 12:53 PM
hi thanks for reply.
how ever that didn't work for me.
But i have found the solution
Store store = Session.getDefaultInstance().getStore();
Folder[] folders = store.list(Folder.INBOX);
Folder inbox = folders[0];
Message[] msgs = null;
try {
msgs = inbox.getMessages();
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}