更改 google 表单回复的发件人地址
Change the sender address for google form response
我有这个脚本,用于 运行 一个人提交后的电子邮件回复,有没有办法更改发件人?因为我看到这和制作脚本的人有关。
function onFormSubmit(e) {
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var emailRecipients = e.namedValues[headers[7]] + "@google.com";
var emailSubject = "New holiday request";
var emailBody = "<h3>Hello "+e.namedValues[headers[7]]+", this a new vacation request by an agent </p>";
MailApp.sendEmail({
to: emailRecipients,
subject: emailSubject,
htmlBody: emailBody
});
}
发件人始终是创建触发器的人
如果您想更改发件人,您的选择是:
- 在电子表格中添加另一个编辑器并让他创建
onSubmit
触发器 - 在这种情况下,这个新编辑器将成为发件人
- 使用 service account with domain-wide delegation - 这将允许您作为任何域用户进行身份验证并代表他发送电子邮件
- 创建一个 delegate or an alias and send with the Advanced Gmail Service 并代表别名 (sendAs) 或委托人发送电子邮件
我有这个脚本,用于 运行 一个人提交后的电子邮件回复,有没有办法更改发件人?因为我看到这和制作脚本的人有关。
function onFormSubmit(e) {
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var emailRecipients = e.namedValues[headers[7]] + "@google.com";
var emailSubject = "New holiday request";
var emailBody = "<h3>Hello "+e.namedValues[headers[7]]+", this a new vacation request by an agent </p>";
MailApp.sendEmail({
to: emailRecipients,
subject: emailSubject,
htmlBody: emailBody
});
}
发件人始终是创建触发器的人
如果您想更改发件人,您的选择是:
- 在电子表格中添加另一个编辑器并让他创建
onSubmit
触发器 - 在这种情况下,这个新编辑器将成为发件人 - 使用 service account with domain-wide delegation - 这将允许您作为任何域用户进行身份验证并代表他发送电子邮件
- 创建一个 delegate or an alias and send with the Advanced Gmail Service 并代表别名 (sendAs) 或委托人发送电子邮件