1

I desperately try to find a way to remove the system label "Inbox" from emails that have another label (e.g. News) already assigned.

My idea behind is to have incoming messages first in the inbox and automatically labelled and secondly removed from the inbox but still labelled after a certain time point.

How can I make it conditional using:

function removeLabel (){for (var i = 0; i < labels.length; i++) {
    if (labels[i].getName().indexOf("Inbox") > -1) {
        //If the WORD is found in label name - delete the label
        labels[i].deleteLabel();}
  • It's not clear what is this question about. Are you using Google Apps Script or the Gmail API? – Rubén Jul 6 at 16:50