It's been my experience over the past few years that the majority of contact forms on web pages of both large companies as well as governmental institutions fail to handle line breaks properly in one way or another.
Typically, such a contact form consists of several single-line text boxes for contact details of the inquirer and one multi-line text box intended for the actual message:
When using such a form, I give the message a classic business letter/e-mail look and feel. I include salutation, closing and multiple paragraphs separated by line breaks to make the message as easy to read as possible for the customer service person on the other end.
I find that line breaks in the actual message often get messed up:
E-mail: [email protected]
Message: Hello, my name is John and I would like to know more about UX. Please let me know if there is a way to achieve X using Y. Thanks in advance. Best wishes, John
Being involved in web development myself, I'm aware that handling line breaks can sometimes involve a little work in order to make them work correctly. On the other hand, failure to handle line breaks at all would seem like a beginner's mistake.
Thus my question(s): Why is removal of line breaks in contact form messages so common? Is there a specific reason from UX point of view to disregard line breaks in contact form fields?
I would guess that any of the following could be the cause:
The bottom line is if this was specified in the design and everyone in the team agreed to do it, then the developers would have found a way to meet the design without falling foul of the security policies, and the data entered by the user would be converted with line breaks.
In my experience, this all comes down to the developer of the contact form not replacing the line breaks with proper HTML equivalents in the email message (sent as HTML). Options to format this correctly are to wrap chunks of text with line breaks between them into paragraphs (p) or to simply insert break tags (br) wherever you see a line break.
If the email message were sent as plain text, things would mostly be OK. I say "mostly" because even then there are issues with what constitutes a line break. Is it a linefeed (LF, \n) only, a carriage return (CR, \r) only, or a combination of the 2 (CRLF, \r\n)?
What I do in my email message translations is stick to the RFC standard for plain text emails, which prefers CRLF. When sending HTML messages, I replace explicit CRLF pairs first with br tags, then look for CR and LF individually to also replace with br tags. That typically handles whatever combination is sent to the server on form submission.
It really makes sense to keep the line breaks when translating a message to an email. Likewise, some systems store the user's message and show it on a web page for later reference (history). The same thing typically happens on those pages when the line breaks are not properly transformed (if at all).