Skip to content

Instantly share code, notes, and snippets.

@jarrodhroberson
Created September 12, 2023 17:57
Show Gist options
  • Save jarrodhroberson/2fed3a2904bb25a05a5eea1a9b040cc2 to your computer and use it in GitHub Desktop.
Save jarrodhroberson/2fed3a2904bb25a05a5eea1a9b040cc2 to your computer and use it in GitHub Desktop.
function purge() {
var promotions = GmailApp.search("category:promotions")
for (var i = 0; i < promotions.length; i++) {
Gmail.Users.Threads.remove('me', promotions[i].getId())
}
var forums = GmailApp.search("category:forums")
for (var i = 0; i < forums.length; i++) {
Gmail.Users.Threads.remove('me', forums[i].getId())
}
var updates = GmailApp.search("category:updates")
for (var i = 0; i < updates.length; i++) {
Gmail.Users.Threads.remove('me', updates[i].getId())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment