Last active
July 23, 2017 15:18
-
-
Save pepdiz/6e0c11614f89cf314ffbb71bf8f007a8 to your computer and use it in GitHub Desktop.
Delete gmail emails which matches filter
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 purgeMail() { | |
var GMAIL_LABELS = "label1, label2, label3"; | |
var PURGE_SIZE = 0 | |
var PURGE_DATE = "2010-01-01" | |
GmailApp.moveThreadsToTrash( | |
GmailApp.search(GMAIL_LABELS | |
.split(',') | |
.map(function (e) {return "label:" + e.trim();}) | |
.join('|') + " size:" + PURGE_SIZE.toString() + " before:" + PURGE_DATE)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment