有没有办法检查某个邮件是否使用应用程序脚本在 gmail 中发送?

Is there a way to check if a certain mail is sent in gmail with apps script?

我想从 gmail 发送文件夹中获取特定主题的特定邮件,我该如何实现?只是指导我在哪里查看或放置可能有用的代码片段,只是基本的 if 条件比较检索到的已发送邮件受 subject_variable.

我的逻辑算法:

var subject_variable = "specific subject"

[some code to retrieve specific sent mail with subject_variable]

if(retrieved sent mail subject == subject_variable) 
return 0; 

else execute other part of code I prepared already

您可以使用GmailApp.search

在这里您可以指定主题或标签等参数。

样本:

function myFunction() {
  var messages = GmailApp.search("in : sent subject : specific subject");
  Logger.log("There are " + messages.length + " messages in Sent matching with the specified query.");
}