In my webshop I have contact form and it is submitted successfully, but Comment text area field content show in one line. Suppose customer write like this(with line break) -

Hello, I would like to get a price for the product XY.

I am using this code

{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}

Please tell me what i do ?

3 Answers 3


Most probably your are using a html reader to view the mail and the e-mail which is send is just plain-text.

Therefore it is all in one line.

You could go and edit: app/locale/en_US(or your locale)/email/contact_form.phtml and add some html code to it.

<!--@subject Contact Form@-->
{"var data.name":"Sender Name",
"var data.email":"Sender Email",
"var data.telephone":"Sender Telephone",
"var data.comment":"Comment"}
Name: {{var data.name}}<br />
E-mail: {{var data.email}}<br />
Telephone: {{var data.telephone}}<br />
<br />
Comment: {{var data.comment}}<br />

Only the last line will be in one line.


Try passing the comment into the nl2br function. This should convert it and then display it correctly.

{{var data.comment:escape|nl2br}}
  • 1
    Was looking for something like this, unfortunately does not work for me in M2 html email template, it doesn't echo the variable if I do this
    – 00-BBB
    Aug 25, 2020 at 14:23

This works:

Comment: {{var data.comment|nl2br}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.