【问题标题】:GmailApp/MailApp not working in Gsuite account, but works in normal accountGmailApp/MailApp 在 Gsuite 帐户中不起作用,但在普通帐户中起作用
【发布时间】:2020-04-24 21:36:29
【问题描述】:

下面是我正在使用的简单代码,当我使用普通的谷歌帐户时它工作正常,但是当我使用 g 套件帐户时,我收到以下错误。如何为我的 gsuite 帐户启用 GmailApp 或 MailApp?

注意:我已经在高级服务下启用了 Gmail API

错误: [20-04-24 16:28:57:730 IST] TypeError: GmailApp.sendMail is not a function at myFunction(eMail:11:26) 功能:

    function myFunction() {
        var email = "xyz@gmail.com";
        var name = "My Name";
        var subject = "Test Subject";
        var body = "Hi";

        GmailApp.sendMail(email,subject,body,{noreply:true});
    }

【问题讨论】:

  • 请采纳答案

标签: google-apps-script


【解决方案1】:

方法的正确名称是GmailApp.sendEmail(),而不是sendMail()

您可以查阅 GmailApp here 类的所有可用方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-21
    • 2016-06-08
    • 2013-06-26
    • 2021-12-21
    • 1970-01-01
    • 1970-01-01
    • 2018-07-11
    • 1970-01-01
    相关资源
    最近更新 更多