// The name of the Gmail Label that is to be checked for purging? var LABELS_TO_DELETE = [ "notifications-github", "notifications-trello", "notifications-hipchat" ]; var TRIGGER_NAME = "dailyDeleteGmail"; // Purge messages in the above label automatically after how many days? var DELETE_AFTER_DAYS = "4"; var TIMEZONE = "AEST"; // Maximum number of threads to process per run var PAGE_SIZE = 150; // If number of threads exceeds page size, resume job after X mins (max execution time is 6 mins) var RESUME_FREQUENCY = 10; /* IMPLEMENTATION */ function Intialize() { return; } function Install() { // First run 2 mins after install ScriptApp.newTrigger("adHoc_" + TRIGGER_NAME) .timeBased() .at(new Date((new Date()).getTime() + 1000*60*2)) .create(); // Run daily there after ScriptApp.newTrigger(TRIGGER_NAME) .timeBased().everyDays(1).create(); } function Uninstall() { var triggers = ScriptApp.getProjectTriggers(); for (var i=0; i