简体   繁体   中英

Getting unread count in Sent Folder using Google Apps Script - GMail

Is there a way to get Unread Mail count in Sent Folder?

Basically, the feature I want is: When I reply to a message in mailing list that's filtered and doesn't pass my INBOX, I want all the subsequent replies to be reaching my INBOX.

The way I'm trying to accomplish is that if I see a Unread Mail in Sent folder, that means that there is a new mail in a thread I was involved. I'm saying this because I see those mails as unread when I click "Sent" in Gmail's web interface.

So, is there a way to get unread count for a system label?

Dirty way: One way I could accomplish this is creating a filter that selects all mails that has "from:" as my address and use that to get what I want. But, this way I'm creating a duplicate of which I don't feel good about!

One of the wonderful things about GmailApp in Apps Script is the ability to use the same search features that you have in Gmail (quite powerful).

To see all unread messages in Sent folder, search with the following string

is:unread label:sent

Something like

  var query = 'is:unread label:sent'; 
  var threads = GmailApp.search(query);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM