Component: SP Page Builder → Form Builder add-on
Versions affected: 6.7.1, 6.8.0 (likely all 6.x)
File: components/com_sppagebuilder/addons/form_builder/site.php
Description:
When a user submits a Form Builder form containing a textarea field (e.g., a message field), line breaks in the textarea content are lost in the delivered email. Multi-line messages arrive as a single flattened line which is hard to read if long.
Root cause:
The Form Builder add-on sends emails in HTML mode ($isHtmlMode = true at line ~928) but does not convert newlines to <br> tags before substituting field values into the email template. At line ~876:
$emailBody = str_replace("{{" . $name . "}}", $value, $emailBody);
The raw $value (which contains \n from textarea input) is inserted directly into the HTML email body. HTML email clients treat bare \n as whitespace, collapsing multi-line content into a single line.
The older ajax_contact add-on handles this correctly with nl2br():
$message = nl2br($input['value']); // ajax_contact/site.php, line ~361
The form_builder add-on is missing the equivalent call.
Suggested fix:
Apply nl2br() to field values when substituting into the HTML email body:
$emailBody = str_replace("{{" . $name . "}}", nl2br($value), $emailBody);
This is a no-op for single-line inputs (text, email, phone) since they contain no newlines. Only textarea fields are affected. The email subject substitution should remain unchanged (subjects should be single-line).
Steps to reproduce:
- Create a Form Builder form with a textarea field
- Submit the form with multi-line content (press Enter between lines)
- Check the received email — line breaks are missing