Gmail – Batch Processing Filters Guide

gmail

I have many different labels in my Gmail account. I've set up my filters to attach labels such as newsletters and social to these emails as they come in. Once these emails are read, I want them to be archived and simply "gone" from the inbox. This is possible using the following filter, selecting all mail, then clicking archive:

((label:social-facebook OR label:social-twitter OR label:G+ OR label:social-spotify OR label:newsletters OR label:scanned OR label:shopping-ebay OR label:shopping-paypal) AND is:read AND label:inbox)

Is there is an easier way to go about this?

Best Answer

Gmail's filters are processed immediately after the e-mail arrives in your inbox. You can not use a filter for processing an email inbox yet. What you are looking for is possible with a google script:

function processInbox() {
  var threads = GmailApp.getInboxThreads();
  for (var i = 0; i < threads.length; i++) {
    var th = threads[i];
    if (!th.isUnread() && !th.isImportant() && !th.hasStarredMessages()) {
      th.moveToArchive()
    }
    Utilities.sleep(1000);
  }
}

Drive > new script > past the code > run and autorize > create a trigger for 4/6 hours..