Line breaks are not displayed in emails | Community
Skip to main content
June 22, 2015
Question

Line breaks are not displayed in emails

  • June 22, 2015
  • 2 replies
  • 6261 views

Hi,

I am trying to set up a support form with input fields and a textarea where our customers can submit there problems.

After the customer submits the form, our support team gets an email with all the form fields. Easy so far.

Now I have the problem, that line breaks within the textarea are not interpreted as such in the email.

The text from the textarea is one big paragraph in the email.

Any ideas how the line breaks can be displayed?

Thanks for your help!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

SanfordWhiteman
New Participant
June 22, 2015

Florian, to be clear, there isn't a bug here, because the way newlines are entered into textareas is supposed to be different (by design) from the way you force newlines in HTML. Or maybe to put it another way, the text in a textbox isn't HTML, so you naturally have to change it if it's going in an HTML email.

Anyway, the solution is to just trap the text in the form's onSubmit and use one of the methods outlined here: javascript - How do I replace all line breaks in a string with <br /> tags? - Stack Overflow

Note you will be permanently altering the field this way. I expect that's not a problem for your case.

June 25, 2015

Thank you for you help!

This seems to me to be the best way to do it.

SanfordWhiteman
New Participant
June 25, 2015

Demo here BTW.

Josh_Hill13
New Participant
June 22, 2015

Do a search for that. I believe someone fixed this somewhere.

But it may not be fixable easily.

Also, i'd suggest using SFDC Cases or an actual support tracking tool instead.