function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RiflemanRifleman 

Carriage Returns in Rich Text Boxes

We've written an apex class that uses an email service to ingest an email, parse it and populate an object record.  The body of the email is displayed to our end users in the object as a rich text area.  However, when they open the object record, the body of the email is run together, disregarding the carriage returns in the original inbound email.  We created a test field that was a regular text area and when we populate it, carriage returns are maintained.  


Essentially, this is what happens:

Original email body:

Hi,

How are you?

Doing great here!

Sincerely,

Tom

 

Rich Text Area:

Hi,How are you?Doing great here!Sincerely,Tom

 

Normal Text Area:

Hi,

How are you?

Doing great here!

Sincerely,

Tom

 

Does anyone have any idea as to how to fix this issue?  Changing the rich text area to a normal text area is not an option.

 

Thanks


sbbsbb

I had to deal with a similar issue quite a while ago. If I remember correctly, the solution was to replace the carriage return character in the incoming email text with "<br />". I would give it a shot and see if it works!