Need help on how to read imap messages unread count
BharathIO opened this issue · comments
Hi,
Tried with the example given here https://github.com/jonhoo/rust-imap/blob/master/examples/basic.rs, I am not able to read unread emails count. My account is on gmail. Please suggest and correct me if I'm wrong anywhere
Hi! I can't really help without further details. To find unread emails, you'll need to do a search
for something like UNSEEN
and then iterate over the results to get the actual number. You may find the code in buzz
helpful. I would also recommend you use the alpha version of imap 3.0.0
rather than the current release, as it contains a lot of improvements.
Thank you, need another help. Fetch command is always fetching only one email from bottom. Can you help with sample code on how to read top most unread email.
You'll want to use search, not fetch, to find the messages. And then use fetch to fetch additional information about a set of message identifiers afterwards. Again, see buzz for an example :)