How to delete a lot of mails from GMail?

You can do it via Google Apps Script:

01

02

// https://gist.github.com/gene1wood/0f455239490e5342fa49
function moveRMLogToTrash() {
    var batchSize = 100;
    var threads = GmailApp.search('label:rm-log', 0, 400);
    for (j = 0; j < threads.length; j += batchSize) {
        GmailApp['moveThreadsToTrash'](threads.slice(j, j + batchSize));
    }
}

gist.github.com/gene1wood/0f455239490e5342fa49

// https://www.reddit.com/r/GoogleAppsScript/comments/10drt2e/comment/j4nlk0o
const emptyTrash = () => {
    const threads = GmailApp.search('in:trash label:rm-log');
    for (const t of threads) {
        try {Gmail.Users.Messages.remove('me', t.getId());} catch(e) {}
    }
};

reddit.com/r/GoogleAppsScript/comments/10drt2e/comment/j4nlk0o

03

{
  "oauthScopes": [
    "https://mail.google.com/",
    "https://www.googleapis.com/auth/gmail.readonly",
    "https://www.googleapis.com/auth/gmail.modify"
  ],
  "timeZone": "Europe/Istanbul",
  "dependencies": {
    "enabledAdvancedServices": [
      {
        "userSymbol": "Gmail",
        "version": "v1",
        "serviceId": "gmail"
      }
    ]
  },
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}

07

06