This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function autoDelete() { | |
console.log('Started autoDelete run.'); | |
var delayDays = 2; | |
var maxDate = new Date(); | |
maxDate.setDate(maxDate.getDate()-delayDays); | |
var label = GmailApp.getUserLabelByName("delete me"); | |
var threads = label.getThreads(); | |
if(threads.length > 0){ | |
console.log('Found ' + threads.length + ' emails marked for deletion.'); |