GmailApp.sendEmail CC,CC未收到

时间:2017-05-15 05:30:53

标签: google-apps-script

我正在尝试从Google表单发送CC电子邮件。主要人员可以收到电子邮件通知,但不能收到CC上的人。我的错误在哪里?

function submitForm(e){
  var itemResponses = e.response.getItemResponses();
  var message = '';
  for (var i = 0; i < itemResponses.length; i++) {
    var itemResponse = itemResponses[i];
    var question = itemResponse.getItem().getTitle();
    var answer = itemResponse.getResponse();
    message += (i + 1).toString() + '. ' + question + ': ' + answer + '\n';
}
  var address = "example@email.com"; // it is working untill here and can send email
  var cc = address+["example2@email.co.jp","example3@email.com.jp"]; // this is not working
  var title = '届出書が送信されました';
  var content = '以下の内容で届出書が送信されました。\n\n' + message;
  GmailApp.sendEmail(address, title, content);
}

1 个答案:

答案 0 :(得分:2)

cc的值应该是以逗号分隔的电子邮件地址列表,您需要额外options(请参阅高级参数),例如:

...
var address = "example@email.com";
var ccEmail = address + "," + "example2@email.co.jp","example3@email.com.jp";
var title = '届出書が送信されました';
var content = '以下の内容で届出書が送信されました。\n\n' + message;
GmailApp.sendEmail(address, title, content,{cc: ccEmail});
---