*
The moose likes Other JSE/JEE APIs and the fly likes Mark Mail as SEEN 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 » Other JSE/JEE APIs
Bookmark "Mark Mail as SEEN" Watch "Mark Mail as SEEN" New topic
Author

Mark Mail as SEEN

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 753
Hi i am reading mail using java mail and marking all the read mails as SEEN

but next time when i print the total unread mails it's giving me wrong count. seems like SEEN flag is not working as i was expecting.

am i missing something ?

Bellow is my code to read mails




Jigar Naik


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
From this excellent JavaMail tutorial:
Just because a flag exists doesn't mean the flag is supported by all mail servers/providers. For instance, besides deleting messages, the POP protocol supports none of them. ... To find out what flags are supported, ask the folder with getPermanentFlags().


Ping & DNS - my free Android networking tools app
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 753
okay, but then how do i distinguish new Mails from the list of thousand mails ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
If you're using POP3 then you need to do that in your client code.
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 753
Can you please give me some hint. i m clueless.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
The client needs to keep track of which messages have been looked at, possibly by making a note of their subject, sender and time, or some other uniquely identifying characteristic (look through the message headers - there may be a message ID or something similar that you can use). This needs to be stored on the client somewhere, so that it is available next time the client is run.
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 753
ok.

Thanks ulf,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mark Mail as SEEN
 
Similar Threads
Matching mail message with UUID
Message not getting deleted from server + Java Mail
Unable to get the list of folders in hotmail using JavaMail
fetch email with java mail api
MessagingException: Connect failed