MailApp.sendEmail can take htmlBody as advancedArgs. Descripted in here http://code.google.com/googleapps/appsscript/class_mailapp.html
You can send htmlBody like
function sendFormByEmail(e) {
var email = "[email protected]";
var subject = e.namedValues["Subject"].toString();
var msgHtml = "<b>Time</b>: " + e.namedValues["Timestamp"].toString() + "<br/>"
+ "<b>Name:</b> " + e.namedValues["Name"].toString() + "<br/>"
+ "<b>Email:</b> " + e.namedValues["Email Address"].toString() + "<br/>"
+ "<b>Website:</b> " + e.namedValues["Website"].toString() + "<br/>"
+ "<b>Reason For Contacting?:</b> " + e.namedValues["Reason For Contacting?"].toString() + "<br/>"
+ "<b>Message:</b> " + e.namedValues["Message"].toString() + "<br/>";
var msgPlain = msgHtml.replace(/<br/>/gi, '
').replace(/(<([^>]+)>)/ig, ""); // clear html tags and convert br to new lines for plain mail
MailApp.sendEmail(email, subject, msgPlain, { htmlBody: msgHtml });
}
The above one's for linebreaks. Use this to separate them by paragraphs:
function sendFormByEmail(e) {
var email = "[email protected]";
var subject = e.namedValues["Subject"].toString();
var msgHtml = "<p>" + "<b>Time</b>: " + e.namedValues["Timestamp"].toString() + "</p>"
+ "<p>" + "<b>Name:</b> " + e.namedValues["Name"].toString() + "</p>"
+ "<p>" + "<b>Email:</b> " + e.namedValues["Email Address"].toString() + "</p>"
+ "<p>" + "<b>Website:</b> " + e.namedValues["Website"].toString() + "</p>"
+ "<p>" + "<b>Reason For Contacting?:</b> " + e.namedValues["Reason For Contacting?"].toString() + "</p>"
+ "<p>" + "<b>Message:</b> " + e.namedValues["Message"].toString() + "</p>";
var msgPlain = msgHtml.replace(/(<([^>]+)>)/ig, ""); // clear html tags for plain mail
MailApp.sendEmail(email, subject, msgPlain, { htmlBody: msgHtml });
}
I didnt try but it should work.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…