搜索并清理Gmail

时间:2019-04-03 18:27:28

标签: google-apps-script gmail

我正尝试安排对我的电子邮件的搜索并删除这些电子邮件。我有这个:

function cleanMail(){
  var search = GmailApp.search('from:(abc@mail.com) to:(####@sms.net) subject:subject)');
  var thread = search.getThreads();
  thread.moveToTrash();
}

我得到了

  

TypeError:在对象GmailThread,GmailThread,GmailThread,GmailThread,GmailThread中找不到函数getThreads。'

1 个答案:

答案 0 :(得分:0)

尝试一下:

function cleanMail(){
  var threads = GmailApp.search('from:"abc@mail.com" to:"####@sms.net" subject:"subject"');
  for(var i=0;i<threads.length;i++) {
    threads[i].moveToTrash();
  }
}