In the process of correspondence formed a chain. In the settings of the GMail box, the chains are disabled, but this does not prevent them from forming.

The methods label.addToThread(thread) and label.addToThreads(threads) work on the whole chain (chains), not on a specific letter.

How do you assign a label to a specific chained letter, and not to the whole chain in which this letter is present?

    1 answer 1

    If the user disconnects the chains, they do not cease to operate. In this place, the motives of the developers are more than understandable. Suddenly, the user decides to return "everything as it was"? Perhaps there are some other reasons.

    The concept of assigning a label to a specific message is not implemented in the GmailApp class.

    For these purposes, you can use Advanced Google services - Gmail

     function setLabelToMessage() { // Get label by name 'test' var label = Gmail.Users.Labels.list('me').labels.filter(function (name, l) { return l.name === name; }.bind({}, 'test'))[0]; // Get the first message from the search request var message = Gmail.Users.Messages.list('me', { q: 'subject:Проверка цепей' }).messages[0]; // Set label to message Gmail.Users.Messages.modify({ 'addLabelIds': [label.id] }, 'me', message.id); }