GeeCON Prague 2014*
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


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: 757
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: 42028
    
  64
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: 757
okay, but then how do i distinguish new Mails from the list of thousand mails ?
Ulf Dittmer
Marshal

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

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

Joined: Mar 22, 2005
Posts: 42028
    
  64
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: 757
ok.

Thanks ulf,
 
GeeCON Prague 2014
 
subject: Mark Mail as SEEN