I use Google Spreadsheets' built-in form functionality to build contact forms on my website.
Now, consider this code:
function sendFormByEmail(e)
{
var email = "team@example.com";
subject = e.namedValues["Subject"].toString();
message = "Time: " + e.namedValues["Timestamp"].toString() + "
"
+ "Name: " + e.namedValues["Name"].toString() + "
"
+ "Email: " + e.namedValues["Email Address"].toString() + "
"
+ "Website: " + e.namedValues["Website"].toString() + "
"
+ "Reason For Contacting?: " + e.namedValues["Reason For Contacting?"].toString() + "
"
+ "Message: " + e.namedValues["Message"].toString() + "
";
MailApp.sendEmail(email, subject, message);
}
It makes sure that I receive an email as soon as someone submits the form, the email's body has info. like this (example):
Time: 2012/02/25 11:53
Name: John Davis
Email: John@google.com
Website: http://google.com
Reason For Contacting?: Just wanted to chat with ya
Message: It's been long. Catch me tonight.
So, now you should have a clear idea as to what the code does. The thing is, I want the output to look like this instead (i.e., bold some text):
Time: 2012/02/25 11:53
Name: John Davis
Email: John@google.com
Website: http://google.com
Reason For Contacting?: Just wanted to chat with ya
Message: It's been long. Catch me tonight.
How do I modify the code to achieve this? Thanks.
See Question&Answers more detail:os