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
SFDCAdmin73SFDCAdmin73 

Email Template VF Page - Error Element Type

I am recieving the following error but I am not sure why because I  have "</body" at the bottom of the page. 

Error Error: PDR_South_Central line 10, column 20: The element type "body" must be terminated by the matching end-tag "</body>"
Error Error: The element type "body" must be terminated by the matching end-tag "</body>".

Visualforce Email Template:
<messaging:emailTemplate subject="PDR Generated Prospect is Available for Follow-Up PDR: NA - South Central Seek List" recipientType="User" relatedToType="CampaignMember">
<messaging:htmlEmailBody > 
     <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 14px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 14px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE></p>
                  <font face="arial" size="3">
        <p>Dear Salesforce User,</p>
        <p>New PDR Generated prospect(s)have been assigned to a your <b>PDR Generated</b> seek list and is now available for follow up in the following <b>Power Dialer</b> seek list:<p>
        <p><b>PDR Generated (NA - South Central)</b></p>
        <p>To launch the seek list, please click on the following link: <apex:outputLink value="https://na6.salesforce.com/{!relatedTo.id}">{!relatedTo.Name}</apex:outputLink></p>
<table border="1" >
<tr>
<table border="0" >
                 <tr >
                     <th>Prospect First Name</th><th>Prospect Last Name</th><th> Title </th><th> Phone </th><th> Email </th><th> State </th><th> Country </th><th>Company Name/th><th> Marketing Source</th>
                 </tr>
    <apex:repeat var="cam" value="{!relatedTo.CampaignMember}">
       <tr>
           <td>{!CampaignMember.FirstName}</td>
           <td>{!CampaignMember.LastName}</td>
           <td>{!CampaignMember.Title}</td>
           <td>{!CampaignMember.Phone}</td>
           <td>{!CampaignMember.Email}</td>
           <td>{!CampaignMember.State}</td>
           <td>{!CampaignMember.Country}</td>
           <td>{!CampaignMember.CompanyOrAccount}</td>
           <td>{!CampaignMember.Campaign})}</td>
           </tr>
    </apex:repeat>                
       </table>
        </body>
    </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Best Answer chosen by SFDCAdmin73
Blake TanonBlake Tanon
fix what's in bold.

<messaging:emailTemplate subject="PDR Generated Prospect is Available for Follow-Up PDR: NA - South Central Seek List" recipientType="User" relatedToType="CampaignMember">
<messaging:htmlEmailBody >
     <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 14px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 14px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE></p>//REMOVE
                  <font face="arial" size="3">//CLOSE THIS
        <p>Dear Salesforce User,</p>
        <p>New PDR Generated prospect(s)have been assigned to a your <b>PDR Generated</b> seek list and is now available for follow up in the following <b>Power Dialer</b> seek list:<p>//THIS SHOULD BE CLOSING
        <p><b>PDR Generated (NA - South Central)</b></p>
        <p>To launch the seek list, please click on the following link: <apex:outputLink value="https://na6.salesforce.com/{!relatedTo.id}">{!relatedTo.Name}</apex:outputLink></p>
<table border="1" >//CLOSE THIS
<tr>//CLOSE THIS
<table border="0" >
                 <tr >
                     <th>Prospect First Name</th><th>Prospect Last Name</th><th> Title </th><th> Phone </th><th> Email </th><th> State </th><th> Country </th><th>Company Name/th><th> Marketing Source</th>
                 </tr>
    <apex:repeat var="cam" value="{!relatedTo.CampaignMember}">
       <tr>
           <td>{!CampaignMember.FirstName}</td>
           <td>{!CampaignMember.LastName}</td>
           <td>{!CampaignMember.Title}</td>
           <td>{!CampaignMember.Phone}</td>
           <td>{!CampaignMember.Email}</td>
           <td>{!CampaignMember.State}</td>
           <td>{!CampaignMember.Country}</td>
           <td>{!CampaignMember.CompanyOrAccount}</td>
           <td>{!CampaignMember.Campaign})}</td>
           </tr>
    </apex:repeat>               
       </table>
        </body>
    </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

All Answers

Blake TanonBlake Tanon
fix what's in bold.

<messaging:emailTemplate subject="PDR Generated Prospect is Available for Follow-Up PDR: NA - South Central Seek List" recipientType="User" relatedToType="CampaignMember">
<messaging:htmlEmailBody >
     <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 14px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }
               TD  {font-size: 14px; font-face: verdana }
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE></p>//REMOVE
                  <font face="arial" size="3">//CLOSE THIS
        <p>Dear Salesforce User,</p>
        <p>New PDR Generated prospect(s)have been assigned to a your <b>PDR Generated</b> seek list and is now available for follow up in the following <b>Power Dialer</b> seek list:<p>//THIS SHOULD BE CLOSING
        <p><b>PDR Generated (NA - South Central)</b></p>
        <p>To launch the seek list, please click on the following link: <apex:outputLink value="https://na6.salesforce.com/{!relatedTo.id}">{!relatedTo.Name}</apex:outputLink></p>
<table border="1" >//CLOSE THIS
<tr>//CLOSE THIS
<table border="0" >
                 <tr >
                     <th>Prospect First Name</th><th>Prospect Last Name</th><th> Title </th><th> Phone </th><th> Email </th><th> State </th><th> Country </th><th>Company Name/th><th> Marketing Source</th>
                 </tr>
    <apex:repeat var="cam" value="{!relatedTo.CampaignMember}">
       <tr>
           <td>{!CampaignMember.FirstName}</td>
           <td>{!CampaignMember.LastName}</td>
           <td>{!CampaignMember.Title}</td>
           <td>{!CampaignMember.Phone}</td>
           <td>{!CampaignMember.Email}</td>
           <td>{!CampaignMember.State}</td>
           <td>{!CampaignMember.Country}</td>
           <td>{!CampaignMember.CompanyOrAccount}</td>
           <td>{!CampaignMember.Campaign})}</td>
           </tr>
    </apex:repeat>               
       </table>
        </body>
    </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
This was selected as the best answer
SFDCAdmin73SFDCAdmin73
Thanks Blake! That resolved that error. I am recieving one more Error: Invalid field Name for SObject CampaignMember. 

I am not sure what the correct field name is for SObject CampaignMember.
Blake TanonBlake Tanon
It'll be relatedTo - what ever object your email realtedtotype is will be referenced as that in the template.