The Google App script for clean up your Gmail Inbox
/** | |
* 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