代码之家  ›  专栏  ›  技术社区  ›  testing123

谷歌应用程序脚本搜索和清理电子邮件

  •  0
  • testing123  · 技术社区  · 7 年前

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

    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 回复  |  直到 7 年前
        1
  •  0
  •   Cooper    7 年前

    试试这个:

    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();
      }
    }