将标签添加到电子邮件文件会产生错误

发布于 2025-02-06 16:18:13 字数 774 浏览 1 评论 0原文

我创建了一个脚本,如果他们不包含“ a”标签,并将消息的内容发送到我称为“ ssfunction”的函数,然后将“ ssfunction”的函数发送到它 这是我制作的脚本:

const threads = GmailApp.search('-{label:a}');
 for (const thread of threads) {
   const messages = thread.getMessages();
   const minuteAgo = new Date(Date.now() - 60000);
   if (thread.getLastMessageDate() > minuteAgo) {
     for (const message of messages) {
       if (message.getDate() > minuteAgo) {
       const result = ssfunction(message);
       didUpload = result || didUpload;
       }
     }
     thread.addLabel("a");
   } else {
     const result = ssfunction(messages[messages.length - 1]);
     didUpload = result || didUpload;
     thread.addeLabel("a");
   }

但是我有一个错误: typeerror:thread.addelabel不是函数 非常感谢您提供帮助

I created a script that receives last minute emails if they do not contain a "a" tag and sends the content of the message to a function I called "ssfunction" and then adds the "a" tag to it
And this is the script I made:

const threads = GmailApp.search('-{label:a}');
 for (const thread of threads) {
   const messages = thread.getMessages();
   const minuteAgo = new Date(Date.now() - 60000);
   if (thread.getLastMessageDate() > minuteAgo) {
     for (const message of messages) {
       if (message.getDate() > minuteAgo) {
       const result = ssfunction(message);
       didUpload = result || didUpload;
       }
     }
     thread.addLabel("a");
   } else {
     const result = ssfunction(messages[messages.length - 1]);
     didUpload = result || didUpload;
     thread.addeLabel("a");
   }

But I get such an error:
TypeError: thread.addeLabel is not a function
Thank you so much for all the willingness to help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光倒影 2025-02-13 16:18:13

在您的脚本中,我认为Addelabel的方法名称必须修改为addlabel。我认为这是您错误消息的原因。而且,在addlabel的情况下,该参数是gmaillabel对象。当这些要点反映在您的脚本中时,如下所示。

来自:

thread.addeLabel('a');

到:

var label = GmailApp.getUserLabelByName("a");
thread.addLabel(label);

refernce:

In your script, I thought that the method name of addeLabel is required to be modified to addLabel. I think that this is the reason of your error message. And, in the case of addLabel, the argument is GmailLabel object. When these points are reflected in your script, it becomes as follows.

From:

thread.addeLabel('a');

To:

var label = GmailApp.getUserLabelByName("a");
thread.addLabel(label);

Refernce:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文