Skip to content

Instantly share code, notes, and snippets.

@potato4d
Last active December 24, 2023 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potato4d/a08ade97d65ff882e5751fb85c7b6a6a to your computer and use it in GitHub Desktop.
Save potato4d/a08ade97d65ff882e5751fb85c7b6a6a to your computer and use it in GitHub Desktop.
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()
})
}
@sometheycallme
Copy link

Excellent idea for targets. FYI https://github.com/Cyber-Copilot/GmailCleaner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment