Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 如何在Google电子表格脚本中定义HTML参数?_Google Apps Script - Fatal编程技术网

Google apps script 如何在Google电子表格脚本中定义HTML参数?

Google apps script 如何在Google电子表格脚本中定义HTML参数?,google-apps-script,Google Apps Script,我正在使用下面的脚本在提交表单时生成电子邮件响应。我想知道是否有一种方法可以进一步细化htmlBody变量的HTML代码。例如,我想定义“font face=“tahoma”,但是添加引号会导致变量中断。我该怎么做 function onFormSubmit(e) { var custName = e.values[2]; var toAddress = e.values[3]; var subject = "Thank you for your Support Request";

我正在使用下面的脚本在提交表单时生成电子邮件响应。我想知道是否有一种方法可以进一步细化htmlBody变量的HTML代码。例如,我想定义“font face=“tahoma”,但是添加引号会导致变量中断。我该怎么做

function onFormSubmit(e) {
 var custName = e.values[2];
  var toAddress = e.values[3];
  var subject = "Thank you for your Support Request";
  var htmlBody = "<h2>Hi " + custName + ",</h2><br/><Thank you for contacting our support team. Your support ticket has been created and one of our support engineers will be in touch shortly to help you resolve your issue and answer any questions you may have. Please do not reply to this message via e-mail. This address is automated, unattended, and cannot help with questions or requests.<br/><hr><i>Company Name: " + e.values[1] + "<br/>Ticket type: " + e.values[4] + "<br/> Priority: " + e.values[5] + "<br/>Ticket Subject: " + e.values[6] + "<br/>Description: " + e.values[7] + "</p1></i>";
  var optAdvancedArgs = {name: "Support Team", htmlBody: htmlBody, replyTo: "no-reply@domain.com"};
  MailApp.sendEmail(toAddress, subject, htmlBody, optAdvancedArgs);
}
函数onFormSubmit(e){
var custName=e.values[2];
var-toAddress=e.values[3];
var subject=“感谢您的支持请求”;
var htmlBody=“Hi”+custName+”,
需要在字符串中使用
时使用
\”


\
用于在大多数语言(如果不是所有语言的话)中转义字符串中的某些字符。

您也可以使用单引号和双引号进行“播放”,如本例中,变量
color
需要在引号之间:

  var html = "One (or more) event removed <B>in RED</B> as shown below<BR><BR><TABLE border = 1 cellpadding = 5 bgcolor='"+color+"'><EVENTS></table>"    
var html=“一个(或多个)事件以红色删除,如下所示