问题描述
我尝试制作一个脚本,可以立即永久地自动删除某个发件人的电子邮件,因为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可永久删除具有特定标签的垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!