Skip to content

Instantly share code, notes, and snippets.

@jollychang
Created September 4, 2014 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jollychang/40846431714d41f1b50e to your computer and use it in GitHub Desktop.
Save jollychang/40846431714d41f1b50e to your computer and use it in GitHub Desktop.
用google script每天清一下qaci的邮件,前提是收件人为qaci@douban.com的邮件已做filter标记为“QA/jenkins/from_qaci” 直接执行 https://script.google.com/a/macros/douban.com/s/AKfycbwpuCzHvunxGoC34cJIevKsilqH_p57GcDvB_ZzWXqYPv5basTV/exec
// https://script.google.com/a/macros/douban.com/s/AKfycbwpuCzHvunxGoC34cJIevKsilqH_p57GcDvB_ZzWXqYPv5basTV/exec
/**
* Retrieves a given user label by name and logs the number of unread threads
* associated with that that label.
* For more information on interacting with GMail labels, see
* https://developers.google.com/apps-script/class_gmaillabel
*/
function processLabel(labelName) {
// get the label for given name
var label = GmailApp.getUserLabelByName(labelName);
// get count of all threads in the given label
// var threadCount = label.getUnreadCount();
var threads = label.getThreads();
for (var i = 0; i < threads.length; i++) {
threads[i].moveToTrash();
};
};
/**
* move mail from label to trash
*/
function moveJenkinsMailToTrash(){
processLabel('QA/jenkins/from_qaci')
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment