1
我试图设置一个表格,将通过电子邮件发送给我的人的回应。谷歌脚本援助
这是当前的脚本:
function nl2br_(input_string){
return input_string.replace(/(\r\n|\r|\n)/g,'<br />');
}
function contactUsMailer(e) {
// This script e-mails the contents of a form to a given recipient
// The form must have three fields in the order of: name; e-mail address; and message
// You must change the recipient variable below to your e-mail address
try {
var recipient = '[email protected]';
var timestamp = e.values[0];
var username = e.values[1];
var option = e.values[2];
var details = e.values[3];
var body = username+' sent the following message: '+option ;
var bodyHTML = '\
<p>'+username+' <a href="mailto:'+username+'">'+option+'</a> below are the details </p>\
<blockquote>'+nl2br_(details)+'</blockquote>\
<p>Sent by the <a href="http://www.steegle.com/">Steegle.com</a> Contact Us Form Google Apps Script</p>';
var advancedArgs = {htmlBody:bodyHTML , replyTo:username};
MailApp.sendEmail(recipient, "Contact Us Form", body, advancedArgs);
} catch(e){
MailApp.sendEmail(recipient, "Error - Contact Us Form", e.message);
}
}
这是它的外观时,我收到一封电子邮件:
var timestamp - not important ignore it
var username - their username
var option - this is the "issue"
var details - detail of problem
我真的很喜欢它看起来是这样的:
Username: "username here"
Issue: "issue here"
Details:
"wall of text for details here"
我一直在这一个多小时半,我不能让它看起来像上面显示的任何东西:/