问题
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!
回答1:
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);
来源:https://stackoverflow.com/questions/15367410/getting-unread-count-in-sent-folder-using-google-apps-script-gmail