I am creating a VF email template. In it, I have to create an HTML table as showne below. How we can create that ?

enter image description here I wrote the follwoing code but it does not give me the required output what Ido I need to change ?

<messaging:emailTemplate subject="Legal Case" recipientType="User" relatedToType="Case">   
    <messaging:htmlEmailBody >        
            table, tr, td {
               border: 1px solid black;
               font-family: arial, sans-serif;
               text-align: left;
               font-size: 15px;

        <p><b>Case Info</b></p>
        <table border="1px" >
                <td><b>First Name</b></td><td>{!relatedTo.firstName}</td><td><b>Last Name</b></td><td>{!relatedTo.lastName}</td>

The above code generates the following output:

enter image description here

  • That output looks more or less what you need, no? Description is also appearing in the table, is that the problem? – Mahmood May 1 '17 at 18:07

Change the following line


to this

<td><b>Description</b></td><td colspan='3'>{!relatedTo.Description}</td>

and if you need to give more height to the description column, then add style to it. Something like (add height in px as per your need)

<td><b>Description</b></td><td colspan='3' style='height:60px'>{!relatedTo.Description}</td>
  • Thnx works fine !! – user4567570 May 1 '17 at 18:12
  • @user4567570: help others locating the answer by selecting the answer, if it solved your problem. Thanks. :) – Mahmood May 1 '17 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.