sitelink1 | http://whiteship.tistory.com/1814 |
---|---|
sitelink2 | |
sitelink3 | |
sitelink4 | |
sitelink5 | |
sitelink6 |
private void readEmailListByPop3(String id, String passwd) {
Properties props = makePOP3Properties();
Authenticator auth = getAutheticator(id, passwd);
Session session = Session.getDefaultInstance(props, auth);
Store store = null;
Folder folder = null;
try {
store = session.getStore("pop3");
store.connect();
folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
messages = Arrays.asList(folder.getMessages());
} catch (NoSuchProviderException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
} finally {
try {
folder.close(false);
store.close();
} catch (MessagingException e) {
e.printStackTrace();
}
}
}