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
BillPowell__cBillPowell__c 

Visualforce Email Template Font Tag Issue

Hey all, im trying to learn code and can't seem to find the issue with this. It is giving me the following error: 

Error: New_Sample_Order_Alert line 17, column 44: The element type "font" must be terminated by the matching end-tag "</font>"
Error: The element type "font" must be terminated by the matching end-tag "</font>".

Clearly, in the code sample below, the font tag is closed. I can't seem to find the issue. Suggestions? 

Here is the code: 
 
<messaging:emailTemplate subject="New Sample Order Notification" recipientType="User" relatedToType="Sample_Order__c">

<messaging:htmlEmailBody >
<html>
    <body>
    <STYLE type="text/css">
    TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center}
    TD {font-size: 11px; font-face: verdana}
    TABLE {border: solid #CCCCCC; border-width: 1}
    TR {border: solid #CCCCCC; border-width: 1}
    </style>
    <font face="arial" size="2">
        <p>A new sample order has been requested by {!relatedTo.CreatedBy.Name} with the following details:</p><br>
        <br/>
       
        {!relatedTo.Project_Name__c}</br>
        {!relatedTo.McGrory_Sales_Rep__c}</br>
        {!relatedTo.Company__c}</br>
        {!relatedTo.Contact__c}</br>
        {!relatedTo.Ship_To__c}</br>
        <br/>
        <table border="0">
            <tr>
                <th>Quantity</th>
                <th>Description</th>
            </tr>
         <apex:repeat var="li" value="{!relatedTo.Sample_Order_Line_Items__r}">
            <tr>
                <td>{!li.Quantity__c}</td>
                <td>{!li.Description__c}</td>
                <td>{!li.Width__c}</td>
                <td>{!li.Height__c}</td>
                <td>{!li.Product_Code__c}</td>
            </tr>
          </apex:repeat>
        </table>      
    </font>
   </body>
  </html>
 </messaging:htmlEmailBody>

 <messaging:plainTextEmailBody >
        A new sample order has been requested by {!relatedTo.Name} with the following details:
        
        {!relatedTo.Project_Name__c}
        {!relatedTo.McGrory_Sales_Rep__c}
        {!relatedTo.Company__c}
        {!relatedTo.Contact__c}
        {!relatedTo.Ship_To__c}
        
        [ Quantity ] - [ Description ] - [ Width ] - [ Height ] - [ Product Code ]
        
        <apex:repeat var="li" value="{!relatedTo.Sample_Order_Line_Items__r}">
            [ {!li.Quantity__c} ] - [ {!li.Description__c} ] - [ {!li.Width__c} ] - [ {!li.Height__c} ] - [ {!li.Product_Code__c} ]
        </apex:repeat>
        
    </messaging:plainTextEmailBody>
    
</messaging:EmailTemplate>

 
BillPowell__cBillPowell__c
Still getting the same error: 

Error: New_Sample_Order_Alert line 15, column 39: The element type "font" must be terminated by the matching end-tag "</font>"
Error: The element type "font" must be terminated by the matching end-tag "</font>".
Amit Chaudhary 8Amit Chaudhary 8
Can you try like beloiw
 
<messaging:emailTemplate subject="New Sample Order Notification" recipientType="User" relatedToType="Sample_Order__c">

<messaging:htmlEmailBody >
<html>
    <body>
    <STYLE type="text/css">
    TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center}
    TD {font-size: 11px; font-face: verdana}
    TABLE {border: solid #CCCCCC; border-width: 1}
    TR {border: solid #CCCCCC; border-width: 1}
    </style>
    <font face="arial" size="2">
        <p>A new sample order has been requested by {!relatedTo.CreatedBy.Name} with the following details:</p></br>
       
        {!relatedTo.Project_Name__c}</br>
        {!relatedTo.McGrory_Sales_Rep__c}</br>
        {!relatedTo.Company__c}</br>
        {!relatedTo.Contact__c}</br>
        {!relatedTo.Ship_To__c}</br>
        <br/>
        <table border="0">
            <tr>
                <th>Quantity</th>
                <th>Description</th>
            </tr>
         <apex:repeat var="li" value="{!relatedTo.Sample_Order_Line_Items__r}">
            <tr>
                <td>{!li.Quantity__c}</td>
                <td>{!li.Description__c}</td>
                <td>{!li.Width__c}</td>
                <td>{!li.Height__c}</td>
                <td>{!li.Product_Code__c}</td>
            </tr>
          </apex:repeat>
        </table>      
    </font>
   </body>
  </html>
 </messaging:htmlEmailBody>

 <messaging:plainTextEmailBody >
        A new sample order has been requested by {!relatedTo.Name} with the following details:
        
        {!relatedTo.Project_Name__c}
        {!relatedTo.McGrory_Sales_Rep__c}
        {!relatedTo.Company__c}
        {!relatedTo.Contact__c}
        {!relatedTo.Ship_To__c}
        
        [ Quantity ] - [ Description ] - [ Width ] - [ Height ] - [ Product Code ]
        
        <apex:repeat var="li" value="{!relatedTo.Sample_Order_Line_Items__r}">
            [ {!li.Quantity__c} ] - [ {!li.Description__c} ] - [ {!li.Width__c} ] - [ {!li.Height__c} ] - [ {!li.Product_Code__c} ]
        </apex:repeat>
        
    </messaging:plainTextEmailBody>
    
</messaging:EmailTemplate>

 
Alain CabonAlain Cabon
Hi,

Use <br/> (self-closing tag) for a line break and not <br> or </br> alone (even if there are allowed in HTML)

<br></br>  is equivalent to <br/> (self-closing tag) but there is a risk of an unclosed tag when you use <br> or </br> alone.

https://success.salesforce.com/ideaView?id=08730000000J75C
 
<font face="arial" size="2">
        <p>A new sample order has been requested by {!relatedTo.CreatedBy.Name} with the following details:</p><br/>
       
        {!relatedTo.Project_Name__c}<br/>
        {!relatedTo.McGrory_Sales_Rep__c}<br/>
        {!relatedTo.Company__c}<br/>
        {!relatedTo.Contact__c}<br/>
        {!relatedTo.Ship_To__c}<br/>
        <br/>
        <table border="0">
            <tr>
                <th>Quantity</th>
                <th>Description</th>
            </tr>
         <apex:repeat var="li" value="{!relatedTo.Sample_Order_Line_Items__r}">
            <tr>
                <td>{!li.Quantity__c}</td>
                <td>{!li.Description__c}</td>
                <td>{!li.Width__c}</td>
                <td>{!li.Height__c}</td>
                <td>{!li.Product_Code__c}</td>
            </tr>
          </apex:repeat>
        </table>      
    </font>

Simply write <br/> everywhere you want a line break.

Regards
BillPowell__cBillPowell__c
Thank you! Turned out I had the line break backward as and not