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
Shweta GargShweta Garg 

Line Break in Output text Field email template

Hi All,

How to show Long text area field with Line breaks in email template
You can try :
<apex:outputText value="Your Text" style="white-space:pre;" /> 
It will preserve the spaces .
alos try
 <apex:outputText value="Your Text" escape="false" />  
i hop it helps you
Shweta GargShweta Garg
It did not work.
Here is my code :
<messaging:emailTemplate subject="test" recipientType="Contact" relatedToType="Case">
<messaging:htmlEmailBody >
This is your new Visualforce Email Template.

         <apex:outputText value="{!SUBSTITUTE(SUBSTITUTE(JSENCODE(relatedTo.T_Last_External_Post__c), '\\r\\n', '\\n'),'\\n','<br/>')}" style="white-space:pre;" escape="false"  />
          <apex:outputField value="{!relatedTo.T_Last_External_Post__c}"/>
nothing is working fine.
hi Shweta Garg
Please go to below link for same issue i hop it helps you
Thanks :)
Joey WeemsJoey Weems

For anyone reading this like I just did I can confirm that the solution presented by (Piyush_soni__c) of:

<apex:outputText value="Your Text" style="white-space:pre;" /> 
It will preserve the spaces .
alos try
 <apex:outputText value="Your Text" escape="false" />

Works if you combine the two as such:

<apex:outputText value="Your Text"