未设置为谷歌应用脚​​本时,MailApp.sendEmail会向自己发送电子邮件

时间:2017-02-09 14:26:35

标签: email google-apps-script

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 ",
})

当我向其他用户发送电子邮件时,我发现我最终收到了收件箱中发送给他们的电子邮件。它显示它已发送给我在&#34; To&#34;中输入的用户。区域,但它在我的收件箱中。为什么将它放在我的收件箱而不是已发邮件中?

2 个答案:

答案 0 :(得分:2)

我遇到了这个问题,发现用Mailapp.sendEmail代替Gmailapp.sendEmail是可行的。

答案 1 :(得分:1)

尝试这种方式:

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