Google Apps Script - Gmail, delete forever e-mails in trash with specific label(Google Apps 脚本 - Gmail,永久删除带有特定标签的垃圾箱中的电子邮件)
问题描述
我正在尝试制作一个脚本,该脚本可以立即永久地自动删除来自某个发件人的电子邮件,因为 Gmail 仅允许将电子邮件发送到垃圾箱 30 天的过滤器.请不要暗示默认过滤器就足够了,至于我的情况,至关重要的是我不知道我收到了来自该发件人的电子邮件.
I'm trying to make a script that automatically deletes e-mails from a certain sender immediately and permanently, as Gmail only allows for a filter which sends an e-mail to trash for 30 days. Please do not suggest that the default filter is enough, as for my situation, it is vital that I do not know that I was sent an e-mail from this sender.
我当前的脚本如下所示:
My current script looks like this:
function deleteForever(labelName) {
var threads = GmailApp.search("in:trash label:" + labelName);
for (var i = 0; i < threads.length; i++) {
threads[i].moveToTrash(); // Where I would need a delete forever trigger
}
};
但是,我一直无法找到使用 GmailThread 并将其永久删除的方法,因为不存在用于此目的的函数.我想看看是否有一种方法可以使用 JavaScript 完成任务,但一直找不到方法.
However, I have been unable to figure out a way to use a GmailThread and to delete it permanently as there does not exist a function for this purpose. I was looking to see if there was a way I could finish the task using JavaScript, but have been unable figure out a method.
有没有人知道如何设置这些电子邮件在收到时永久删除?
Does anyone have an idea how I can set these e-mails to delete themselves permanently when received?
推荐答案
根据设计,使用 GmailApp 永久删除电子邮件是不可能的.
It is not possible, by design, to delete an email permanently using GmailApp.
这篇关于Google Apps 脚本 - Gmail,永久删除带有特定标签的垃圾箱中的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Google Apps 脚本 - Gmail,永久删除带有特定标签的垃圾箱中的电子邮件


基础教程推荐
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 动态更新多个选择框 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01