This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes JavaMail API for Unread yahoo messages not working. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail API for Unread yahoo messages not working." Watch "JavaMail API for Unread yahoo messages not working." New topic
Author

JavaMail API for Unread yahoo messages not working.

Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

Folder folder = store.getFolder("inbox");
folder.open(Folder.READ_WRITE);
Messages[] messages = folder.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));

using this logic i am able to get all unread messages in my gmail account, but the same logic i tried with yahoo account. it is giving all mails in my inbox.
how to get unread mails in yahoo using javamail API???

Thanks.


do or die..!!!
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Gmail is IMAP, whereas Yahoo Mail is POP, if memory serves. From http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailDeleting:
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. Checking for new mail is not a POP task but one built into mail clients. To find out what flags are supported, ask the folder with getPermanentFlags().
Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

ok...i read this link.
new mail messages they have, are not supported by POP at all.
but my question is how to get new mail with different logic.???
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Since POP doesn't support this, you need to code it in your client. Store all message IDs of mails you've already seen, and when you connect the next time, filter out all messages with those IDs.
Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

great idea...ok i will do this...thanks for nice information.

Thank you very very much.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JavaMail API for Unread yahoo messages not working.
 
Similar Threads
Retrieving mails using Java Mail API
Get emails using java mail
how to track emails from particular mail id?
Java mail POP mark as read and unread
Mail kicking back from Marilyn