Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java API
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Other JSE/JEE APIs
Matching mail message with UUID
preethi Ayyappan
Ranch Hand
Posts: 518
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I am trying to read unread mail using pop3 server. But in pop3, as the unread mail is not read, i am taking the UID. But how can I get the mail for the particular UID?
Properties props = System.getProperties(); Session session = Session.getDefaultInstance(props, null); // -- Get hold of a POP3 message store, and connect to it -- store = session.getStore("pop3"); store.connect(popServer, popUser, popPassword); // -- Try to get hold of the default folder -- folder = store.getDefaultFolder(); if (folder == null) throw new Exception("No default folder"); // -- ...and its INBOX -- folder = folder.getFolder("INBOX"); if (folder == null) throw new Exception("No POP3 INBOX"); // -- Open the folder for read only -- folder.open(Folder.READ_ONLY); // -- Get the message wrappers and process them -- Message[] msgs = folder.getMessages(); for (int msgNum = 0; msgNum < msgs.length; msgNum++) { printMessage(msgs[msgNum]); // speakMessage(msgs[msgNum]); if (folder instanceof com.sun.mail.pop3.POP3Folder) { System.out.println("inside if folder"); com.sun.mail.pop3.POP3Folder pf = (com.sun.mail.pop3.POP3Folder)folder; String uid = pf.getUID( msgs[msgNum]); System.out.println("uuuuiiiiddd::::"+uid); } }
Thanks
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Reading Java Mail
How to retrieve mails from POP 3 server
POP3 JavaMail Client-How to Read Unread Mails only
JavaMail: Help with sending e-mails
Problem with Retriving mails from INBOX
More...