我有两个问题:首先,我想用从表单中获取的变量(管理员)替换硬编码的电子邮件地址。我无法让它成功运行,我相信我使用了错误的格式。
function sendEmail(e) {
var email = e.values[1];
var sub = e.values[2];
var manager = e.values[3];
var date = e.values[4];
var checkin = e.values[5];
var checkout = e.values[6];
var totalminutes = e.values[7];
var purpose = e.values[8];
MailApp.sendEmail("<someone@google.com>", "Internal Sub Payment Request",
"What no html?", {htmlBody: html});
}
第二部分是如何通过此电子邮件与某人联系?当我尝试添加它时,我收到消息“无法找到方法sendEmail(字符串,字符串,字符串,字符串,对象)。(第24行,文件”代码“)”
MailApp.sendEmail(e.parameter.reply, "Internal Sub Payment Request Status",
"Your manager said: "+ answer);
答案 0 :(得分:0)
如果您要发送多个电子邮件地址,则需要确保它们以字符串逗号分隔。看起来您从错误(string,string,string,string,object)
简单发送
MailApp.sendEmail("email1@gmail.com, email2@gmail.com", "Subject", "Body");
要添加CC地址,请将cc
属性添加到第四个可选对象参数。
MailApp.sendEmail('email1@gmail.com, email2@gmail.com', "Subject", "Body",
{ cc: "ccaddress@gmail.com, ccaddress2@gmail.com" });
https://developers.google.com/apps-script/reference/mail/mail-app