The Google App script for clean up your Gmail Inbox
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
/** | |
* Gmail Cleaner v0.1.0 | |
* publishedAt: 2020/10/25 | |
* Author: @potato4d | |
* LICENSE: MIT | |
**/ | |
// TODO: Customize | |
const target = [ | |
'notifications@github.com', | |
'builds@circleci.com' | |
] | |
function cleanupThreads() { | |
if (!target.length) { | |
return | |
} | |
console.log('Search threads..') | |
const threads = GmailApp.search(`label: unread AND (from: ${target.join(' OR from: ')})`) | |
console.log('Threads count :' + threads.length) | |
threads.forEach((thread) => { | |
thread.markRead() | |
// If you want to add to the trash | |
// thread.moveToTrash() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment