【问题标题】:MailApp.sendEmail sending email to myself when not set to in google apps scriptMailApp.sendEmail 在谷歌应用程序脚本中未设置时向自己发送电子邮件
【发布时间】:2017-02-09 14:26:35
【问题描述】:
MailApp.sendEmail({
to: " someemail@gmail.com , ",
subject: "New change for " + variable1+ " at " + variable2,
htmlBody: "Added: " + addedlist_new.toString() + "<br><br>" + 
"Removed: " + removedlist_old.toString() + "<br><br>" +
" https://docs.google.com/spreadsheets/d/someurlhere ",
})

当我收到一封发送给我以外的用户的电子邮件时,我发现我的收件箱中最终收到了发送给他们的电子邮件。它显示它已发送给我在“收件人”区域中输入的用户,但它在我的收件箱中。为什么它将它放在我的收件箱而不是已发送邮件中?

【问题讨论】:

  • 它是否在您的收件箱中,或者您是否也看到了您发送的项目?电子邮件是从您的帐户发送的,发送者设置为您。
  • 它在我的收件箱中,因为“收件人”字段是其他人。就像“已发送”电子邮件在收件箱中,而不是已发送邮件。为什么会这样?
  • 这可能是由于以下原因之一:Why Do Gmail Sent Items Show in the Inbox? 或者您正在使用启用了“从不发送到垃圾邮件”选项的过滤器,即(可能偶然地)匹配您发送的消息,它们将显示在收件箱中。或forum message 中的原因之一
  • 我没有任何过滤器导致此问题。
  • 也许可以去掉 To make it to: "someemail@gmail.com", 上引号内的逗号

标签: email google-apps-script


【解决方案1】:

我遇到了这个问题,发现用Gmailapp.sendEmail 替换Mailapp.sendEmail 有效。

【讨论】:

  • 您必须向脚本提供 Gmail 权限(如果您还没有)。还要考虑到这种发送方式不会在您的“已发送”文件夹中注册,而在 MailApp 中它会注册(除了在您的收件箱中弹出)
【解决方案2】:

试试这个方法:

var toEmail = "someemail@gmail.com";

var subject = "New change for " + variable1+ " at " + variable2;

var messageBody = "Added: " + addedlist_new.toString() + "<br><br>" + "Removed: " + removedlist_old.toString() + "<br><br>" + "https://docs.google.com/spreadsheets/d/someurlhere";

MailApp.sendEmail(toEmail , subject , "" , {htmlBody: messageBody});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-24
    • 1970-01-01
    • 1970-01-01
    • 2020-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-15
    相关资源
    最近更新 更多