【发布时间】:2021-10-27 05:37:14
【问题描述】:
专家,我需要您的帮助。感谢所有这些。
我遇到了一个奇怪的情况。当我尝试在我的个人 Google 帐户中运行unbound 脚本时,我收到“此应用被阻止”错误。
我的个人 gmail 帐户中有 39 个文件夹,每个文件夹都包含来自不同发件人的重要电子邮件。这些文件夹包含过时的电子邮件,所以我使用下面的脚本来删除旧的电子邮件:
/*
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));
}
}
我需要此脚本的副本来处理 39 个文件夹中的每一个,因此我安装了脚本,将脚本指向文件夹 #1,运行脚本以对其进行授权,并设置我的触发器(每月 1 日)。
然后我复制了脚本并重复了文件夹 #2 的设置过程,然后是文件夹 #3,依此类推...请记住,这些都是我个人帐户中的 UNBOUND 脚本。 p>
专家,为什么会这样?更好的是,我该如何解决? (是否可以依次“循环”浏览 39 个文件夹中的每一个?搜索词永远不会改变,只会改变文件夹名称。)
我迷路了。有人有什么见解吗?
【问题讨论】:
-
我不明白您所说的 文件夹 是什么意思。您是指 Gmail 标签吗?
-
我最谦虚的道歉,好心的先生。谢谢你叫我出来。我用错了词。是的,我的意思是说“我的 Gmail 帐户中有 39 个标签,每个标签都包含……”我应该说不同的地方......
-
应该可以循环遍历。但是,需要将此错误报告给 Google。见stackoverflow.com/questions/66633659/…
-
@user3279926 TheMaster 分享的答案对您有帮助吗?请对其进行测试并在此处分享您的发现。