Contact form text area not retaining 'new line'
Author: Barry M.
Visited 1144,
Followers 1,
Shared 0
Hello.
I have set up a new website and have added a 'contact form' area where customers can contact me. I have a NAME field, and EMAIL field, and a TYPE YOUR MESSAGE field. However, on testing this, I entered some text then the ENTER key to go to a new line, some more text, another ENTER key, and so on. When I received the email from the website, all the text was put together in one long message with the 'new lines' ignored. Is there any way to have the ENTER key's functionality reflected in the sent email?
Thanks,
Barry M
Posted on the
Hello Barry,
There is probably on your mail receiver account some settings that can help you.
I receive this nicely (with line separation, just tested this)
See that CSS / HTML formatting is set to on, or that line breaks are not removed. So please check your settings from you mail account.
Author
Hello, Andre.
Thanks for you response.
I modified my OUTLOOK 2007 email setting to not remove line breaks, but this did not fix my problem. I show the HTML of my received message below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="Incomedia WebSite X5 Professional 2021.1.4 - www.websitex5.com">
</head>
<body bgcolor="transparent" style="background-color: transparent;">
<table border="0" cellpadding="0" align="center" cellspacing="0" style="padding: 0; margin: 0 auto; width: 700px;">
<tr><td id="imEmailContent" style="min-height: 300px; padding: 10px; font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; width: 700px; border-style: solid; border-color: #000000; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0; border-bottom: none; border-left-width: 1px; background-color: #FFFFFF" width="700px">
Thankyou for contacting the ~~~~~~~~~~~~~~ website. Your request is shown below. I will get back to you as soon as possible.
<br><br>
<table border=0 width="100%">
<tr valign="top"><td width="25%" style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "><b>FIRST NAME: </b></td><td style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "></td></tr>
<tr valign="top"><td width="25%" style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "><b>SURNAME: </b></td><td style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "></td></tr>
<tr valign="top"><td width="25%" style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "><b>EMAIL: </b></td><td style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "><a href="mailto:~~~~~~~~~@~~~~~~~.~~~">~~~~~~~~~@~~~~~~~.~~~</a></td></tr>
<tr valign="top"><td width="25%" style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; "><b>TYPE YOUR MESSAGE: </b></td><td style="font: normal normal normal 9pt 'Verdana'; color: #000000; background-color: #FFFFFF; text-decoration: none; text-align: left; ">line 1
line 2
line 3
line 4</td></tr>
</table> </td></tr>
<tr><td id="imEmailFooter" style="font: normal normal normal 7pt 'Verdana'; color: #000000; background-color: transparent; text-decoration: none; text-align: center; width: 700px;border-style: solid; border-color: #000000; border-top-width: 0; border-top: none; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; padding: 10px; background-color: #FFFFFF" width="700px">
This e-mail contains information that is intended solely for the above mentioned addressee.<br>If you have received this e-mail in error, please notify the sender immediately and destroy it, without copying it.
</td></tr>
</table>
</body>
</html>
This shows the 4 lines of text on individual lines in the 'TYPE YOUR MESSAGE' area, but there are no <br> tags to break the lines up on output.
Thanks,
Barry M.
Andre & Barry, I send contact form by email, not to database. My CR's are always stripped. Could this be the reason?
Author
Hello, Esahc & Andre.
I also send my contact form by email, not to a database. I chose this so the emails appear straight away, and I can reply with out a delay. Perhaps sending by email is the cause of the stripped CRs.
Thanks,
Barry M.
We asked the same question years ago and the answer was:
For security reasons, all control characters are removed from the text fields in order to avoid malicious code being inserted.
JJ.
Author
Hello, JJ. JUAG.
I guess that this is the final answer. It seems to me to make the Contact Form rather useless to me if it removes all the control characters that users have used in their response to me. The layout of their response is often just as important as the text itself, as new lines are used to delineate various parts of the response to make it clearer.
Thanks,
Barry M.
I will set this as IDEA post, i also think you should see it the way it's written.
If it is for malicious code then leave at least some standards like line breaks in the code.
Author
Hello, Andre.
I hope the developers agree with your comment.
Thanks,
Barry