谷歌脚本mailapp.sendEmail只适用于我的电子邮件地址(Google script ma

2019-08-18 04:37发布

好吧,这是很奇怪的。 我的脚本在电子表格中从当前活动片采取信息,创建使用模板文件的一份报告,并将其发送作为附件。

这一切都完美的作品,当我用我的谷歌Apps网域帐户的电子邮件地址作为收件人。 当我比我自己发送到任何其他电子邮件地址,等它不工作。 这是工作昨天。 在脚本运行时不会产生任何错误

我做的唯一的事情就是改变电子表格的所有者在我们的领域其他用户。 它与其他用户共享的,而我是测试脚本。 我已经在我们的领域使用其他电子邮件地址尝试并创造了新的电子表格与sendemail功能,都具有相同的行为。

// Email the specified report
function emailReport(file, recipients, emailSubject, emailMessage) {
 MailApp.sendEmail("someone@example.com", emailSubject, emailMessage, 
              {attachments: file, mimetype: 'application/pdf'});
}

Answer 1:

我注意到这个问题而回,甚至在另外一个引用它。 从那以后,我发现没有人回应你这么...

它看起来好像谷歌最近改变(虽然没有记载任何地方,我发现)的MailApp.sendEmail功能,使得它,只有当你使用属于试算表的拥有者的电子邮件地址的作品。

我的猜测是,这是为了防止被用于不请自来的群发邮件系统。

另一个问题是在这里

(对不起,不是一个答案,例如:(更多的确认,以什么你看到似乎是如预期)



Answer 2:

我已经能够重现问题并找到解决方法。

因为它不是更多钞票,以发送电子邮件的收件人没有谷歌帐户,我再补充一点那种电子邮件上的CC场。

// Email the specified report as cc
function emailReport(file, recipients, emailSubject, emailMessage) {
 MailApp.sendEmail("my@gmail.com", emailSubject, emailMessage, 
              {attachments: file, mimetype: 'application/pdf', cc:"someone@example.com"});
}


Answer 3:

对于有这个问题的人,使用GmailApp类而不是MailApp类。

它支持相同的功能,例如: GmailApp.sendMail('recipient@gmail.com', 'Subject', 'Message')

https://developers.google.com/apps-script/reference/gmail/gmail-app#sendEmail(String,String,String)



文章来源: Google script mailapp.sendEmail only works with my email address