I have a TextArea() that I'm collecting user input from.
I'd like to spit this input back out into an email, but it's important to preserve the formatting. If someone puts in returns or paragraphs to separate their statements, I want that to be reflected in the output.
Currently, I have this input assigned to a variable, and then I reference the variable in the MailApp() call. It is not preserving formatting through this process:
var user_input=e.parameter.text_area_input;
MailApp.sendEmail({
to: "someemail@somedomain.com",
subject: "This is a subject.",
htmlBody: "Here is the text that was entered: <BR>" + user_input
})
How can I do that?
You are sending a html email so you need to replace new line characters '\n' with line breaks <BR>.
Here are the options
I have not tested the code. It may have syntax error or typo.