Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mark Mail as SEEN

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, but then how do i distinguish new Mails from the list of thousand mails ?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using POP3 then you need to do that in your client code.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please give me some hint. i m clueless.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.

Thanks ulf,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic