This project is read-only.

How to convert CRLF to <br /> in email body?

Topics: Administration, Customizing Orchard, General
Oct 13, 2012 at 10:06 PM

Almost there! I've set up a contact form with custom forms and added a rule to send an email. So far, so good.

However, one of the fields - bericht - is a textarea.

This field is included in the email body:


However, I need to convert CRLF to <br> to keep the users formatting. How do I do this?

I found {Text.LineEncode} but I'm not sure how to use this...



Oct 13, 2012 at 10:35 PM
Edited Oct 13, 2012 at 10:38 PM

If the token you are using is correctly returning a text token, then you just chain .LineEncode and that's it. So that would be {Content.Fields.FormBestelling.Bericht.Value.LineEncode}

Oct 14, 2012 at 8:46 PM


This is not working for me.

The token is a text field, don't know if you considers this different than a text.

{Content.Fields.FormBestelling.Bericht} show the text, but with CRLF's removed.
{Content.Fields.FormBestelling.Bericht.Length} shows the correct length (Length is defined in the overview as {TextField.Length}).
{Content.Fields.FormBestelling.Bericht.LineEncode} shows nothing (LineEncode is defined in the overview as {Text.LineEncode}).

So I guess there is a difference between Text and TextField. I thought .Value would get me the Text inside the TextField, but this seems not to be the case...

{Content.Fields.FormBestelling.Bericht.Value.LineEncode} shows nothing.

Tried to debug myself, but the code is so overwhelming.

Any suggestions...?

Oct 14, 2012 at 11:33 PM

It's a text field, but not a text token, which would be a bug. Please file it in the issue tracker.

Oct 17, 2012 at 1:21 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.