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

北战南征 提交于 2019-12-23 20:58:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!