Skip to content

Instantly share code, notes, and snippets.

@bultas
Last active November 13, 2016 14:39
Show Gist options
  • Save bultas/969dea2b3afabc70886c0a10d6531bee to your computer and use it in GitHub Desktop.
Save bultas/969dea2b3afabc70886c0a10d6531bee to your computer and use it in GitHub Desktop.
Gmail - Google Apps Script - permanently delete all messages from specific sender
function myFunction() {
var senderEmail = "[email protected]";
var threads = GmailApp.search("from:"+senderEmail);
for (var i = 0; i < threads.length; i++) {
Gmail.Users.Messages.remove('me', threads[i].getId());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment