This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Java mail POP mark as read and unread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Java mail POP mark as read and unread" Watch "Java mail POP mark as read and unread" New topic
Author

Java mail POP mark as read and unread

Loganathan Subramani
Greenhorn

Joined: Mar 31, 2009
Posts: 12
Hi i am developing gmail application using java mail. I can retrieve all my mail from gmail server

store.openFolder("INBOX"); and i can read messages from the folder folder.getMessages();

i can see all the messages. when i use the code

msg.getContext();
.............
...........
folder.close(false);

When i try to execute next time the same code i couldn't get back the mail which i opened already.

if i didn't open the message i can get from server ..

and if i didn't use folder.close method then all the mails i can get from the server...


Please provide me the code to read all messages from server and update opened mails like mark as read,

and when next time i should get all the mails and i should filter whether read msg or unread msg...



Thanks for any help provided
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41064
    
  43
See the last entry for JavaMail in the http://faq.javaranch.com/java/JavaEnterpriseEditionFaq.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Loganathan Subramani wrote:Please provide me the code to read all messages from server and update opened mails like mark as read,

http://faq.javaranch.com/java/NotACodeMill


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Stephen Macciocchi
Greenhorn

Joined: Mar 06, 2012
Posts: 1
It seems that Java Mail P0P3 API is good at reading messages, however, you could store your last read messages - mabye saving the UID & timestamp in a file or db table.

However, came across Java Mail Version 1.4.4 which has some new features available.

http://www.oracle.com/technetwork/java/javamail/index-138643.html?ssSourceSiteId=ocomen

Mabye this will help..


Chaulkie
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java mail POP mark as read and unread
 
Similar Threads
Aspirin Cannot Send Mails
yahoo mail, gmail setup in my web application
Mark Mail as SEEN
JavaMail & MS Exchange Server
JavaMail Flags, IMAP and Gmail Problem