Skip to content

Instantly share code, notes, and snippets.

Created March 28, 2022 09:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
gmail mute that actually mutes
// Enforce thread muting
// When you mute a thread in Gmail, it adds a "Muted" label
// Unfortunately, it doesn't really completely mute the thread - e.g. emails added to the thread will still be marked as unread and show up against folder counts
// This script will ensure that all emails appearing on muted threads, will be marked read, and archived.
// By default it will only look for emails that are less than 3 days old, to limit the size of the query results. You can adjust that if you want to
var age_max="3d"
function enforceMutes() {
var threads ="label:Muted is:unread " + " newer_than:" + age_max);
for (var thread_key in threads) {
var thread = threads[thread_key];
Logger.log(" Archiving: " + thread.getFirstMessageSubject());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment