Experts, I need your help. Thanks to all that weigh in.
I have run in to a strange situation. When I try to run an unbound script in my personal google account, I get a "This app is blocked" error.
I have 39 folders in my personal gmail account, each containing critical email from a different sender. The folders contained emails that were getting outdated, so I am using the script below to delete the older emails:
/*
This script, when used with Google Apps Scripts will delete 500 emails and
can be triggered to run every minute without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Configure the search query in the code below to match the type of emails
you want to delete
Browser to https://script.google.com/.
Start a script and paste in the code below.
After you paste it in, save it and click the little clock looking button.
This is for your triggers. You can set up how frequently you want the script
to run (I did mine for every minute).
Source : # https://productforums.google.com/d/msg/gmail/YeQVDuPIQzA/kpZPDDj8TXkJ
*/
function batchDeleteEmail() {
var batchSize = 100 // Process up to 100 threads at once
var threads = GmailApp.search('label:************ AND older_than:6m AND is:read');
for (j = 0; j < threads.length; j+=batchSize) {
GmailApp.moveThreadsToTrash(threads.slice(j, j+batchSize));
}
}
I needed a duplicate of this script to work on each of the 39 folders, so I installed the script, pointed the script to folder #1, ran the script to authorize it, and set up my trigger (every month on 1st).
Then I copied the script and repeated the setup process for folder #2, then folder #3, and so on... Remember, these are all UNBOUND scripts in my PERSONAL account.
Experts, why is this happening? Better yet, how do I fix it? (Is it possible to "loop" through each of the 39 folders in turn? The search terms never change, only the folder name.)
I'm lost here. Does anybody have any insight?