Created
November 28, 2013 03:38
-
-
Save goyuninfo/7686934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Properties props = System.getProperties(); | |
props.setProperty("mail.pop3.port", prop.getProperty("995")); | |
Session session = Session.getInstance(props, null); | |
Store store = session.getStore("imaps"); | |
store.connect("pop.gmail.com", "name", "password"); | |
javax.mail.Folder[] dfolders = store.getDefaultFolder().list("*"); | |
for (Folder f : dfolders) { | |
System.out.println(f.getFullName()); | |
if ((f.getType() & javax.mail.Folder.HOLDS_MESSAGES) != 0) { | |
System.out.println(f.getMessageCount()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment