[SOLVED] Textarea input in html email body

Trying to take a textarea input from a form and have it display WITH LINEFEEDS in an html email body, but can’t find the magic combination.

I’ve tried “as-is” but everything displays on one line.

Also tried replacing \n with br tags, but that didn’t change anything.

Also tried replacing \n – still no luck

Anybody have the combination to this safe?



Hearing no answers, we’ll go with a custom formatter for PHP.


namespace lib\core;

function formatter_nl2br($val) {
    $text = trim($val); // remove the last \n or whitespace character
    return nl2br($text); // insert <br /> before \n 

Well I don’t think we have a formatter to convert new lines to br tags yet, but it should be pretty easy to build one custom formatter.

Maybe @patrick can give you the one liner :smile:

1 Like

Mine works. All good.

Oh now I see it …sorry wasn’t much awake :slight_smile: - I was thinking of client side formatter…
But you got the server side one - so all good if that is what you need.

1 Like