my dog learned polymorphism
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 Head First Android this week in the Android 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: 760
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
Rancher

Joined: Mar 22, 2005
Posts: 42956
    
  73
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().
Jigar Naik
Ranch Hand

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

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

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

Joined: Mar 22, 2005
Posts: 42956
    
  73
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: 760
ok.

Thanks ulf,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mark Mail as SEEN
 
It's not a secret anymore!