本文介绍了Google 脚本 mailapp.sendEmail 仅适用于我的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这很奇怪.我在电子表格中编写脚本以从当前活动的工作表中获取信息,使用模板文件创建报告并将其作为附件发送.

Okay this is very strange. I have scripting in a spreadsheet to take information from the currently active sheet, creates a report using a template file and sends it as an attachment.

当我使用我的 Google 应用域帐户电子邮件地址作为收件人时,这一切都完美无缺.当我发送到我自己以外的任何其他电子邮件地址时,它不起作用.它昨天工作.脚本运行时没有产生错误

This all works perfectly, when I use my Google apps domain account email address as the recipient. It doesn't work when I send to any other email address, other than my own. It was working yesterday. No errors generated when the script runs

我所做的唯一一件事就是将电子表格的所有者更改为我们域中的另一个用户.在我测试脚本时,它与其他用户共享.我曾尝试使用我们域中的其他电子邮件地址,并使用 sendemail 函数创建了一个新电子表格,所有这些都具有相同的行为.

The only thing that I did was change the owner of the spreadsheet to another user in our domain. It was shared with the other user while I was testing the scripts. I've tried using other email addresses in our domain and created a new spreadsheet with the sendemail function, all with the same behavior.

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

推荐答案

我不久前注意到了这个问题,甚至在另一个问题中也引用了它.从那以后我注意到没有人回复你所以...

I noticed this question a while back, and even referenced it in another one. Since then I've noticed no one responded to you so...

似乎 Google 最近更改了(尽管我发现的任何地方都没有记录)MailApp.sendEmail 函数,因此它仅在您使用属于电子表格所有者的电子邮件地址时才有效.

It appears as if Google has recently changed (though not documented anywhere I've found) the MailApp.sendEmail function so that it only works when you use the email address belonging to the owner of the spread sheet.

我猜这是为了防止系统被用于未经请求的群发电子邮件.

My guess is this is to prevent the system being used for unsolicited mass emailing.

另一个问题是这里

(抱歉,不是这样的答案:(更多的是确认您所看到的似乎符合预期)

(Sorry, not an answer as such :( more of a confirmation as to what you are seeing seems to be as expected)

这篇关于Google 脚本 mailapp.sendEmail 仅适用于我的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 08:17