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
U JayU Jay 

Visualforce email template

This is my code :-
page=>
<messaging:emailTemplate relatedToType="Account" subject="Congregation point of contact notification" recipientType="Contact" >
    <messaging:plainTextEmailBody >
        <html>
            <body>
                <p>Hi {!relatedTo.Point_of_contact__r.Name}</p>
                <p>Below is the list of congregation accounts where you are the point of contact.</p>
                <c:CongrgationPointOfContact accountID="{!relatedTo.ID}"/>
            </body>
        </html>
    </messaging:plainTextEmailBody>
</messaging:emailTemplate>
component =>
<apex:component access="global" controller="congrgationPointOfContactController">
    <apex:attribute name="accountID" type="Id" description="Id of the account" assignTo="{!accountIdValue}"/>

    <apex:dataTable value="{!contactList}" var="CongrgationAccountListItem" border="1px" cellpadding="1">
        <apex:column >
            <apex:facet name="header">Congregation Account Name(Home meeting)</apex:facet>
            <apex:outputText value="{!CongrgationAccountListItem.Name}"/>
        </apex:column>
        <apex:column >
            <apex:facet name="header">Congregation Account ID(Home meeting)</apex:facet>
            <apex:outputText value="{!CongrgationAccountListItem.ID}"/>
        </apex:column>
        <apex:column >
            <apex:facet name="header">Congregation Account ID(Home meeting)</apex:facet>
            <apex:outputText value="{!CongrgationAccountListItem.accountID}"/>
        </apex:column>
    </apex:dataTable>
</apex:component>
controller =>
/******************************************************************************
* @File Name         : congrgationPointOfContactController
* @Description       : class for CongrgationPointOfContact component
* @Copy Right        : NEYM
* @Modification Log  : 17-Sept-2014
* =============================================================================
* Ver    Date                   Author            Modification
* -----------------------------------------------------------------------------
* 1.0    17-Sept-14             QBurst            Created
********************************************************************************/
public class congrgationPointOfContactController{
    public Id accountIdValue {get;set;}
    //public Id contactIdValue {get;set;}
    public List<Account> getCongrgationAccountList(){
        List<Account> accountList = new List<Account>();
        for(Account accountItem : [SELECT id, Name, Point_of_contact__c
                                         
                                   FROM account
                                   WHERE recordTypeID = '012L0000000DELE' AND Id = :accountIdValue]){
            accountList.add(accountItem);                         
        }
        return accountList;  
    }
    public List<Contact> getContactList(){
        System.debug('*******************************accountIdValue'+accountIdValue);
        List<Contact> contactList = new List<Contact>();
        for(Contact contactItem : [SELECT id, Name, AccountID
                                         
                                   FROM contact
                                   WHERE AccountID = :accountIdValue]){
            contactList.add(contactItem);                         
        }
        return contactList;  
    }
}
=====================================
When i save the visual force template shows as below =>
<html>
<body>
<p>Hi </p>
<p>Below is the list of congregation accounts where you are the point of contact.</p><table class="rich-table " id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9" border="1px" cellpadding="1" cellspacing="0"><colgroup span="3"></colgroup><thead class="rich-table-thead"><tr class="rich-table-subheader "><th class="rich-table-subheadercell " scope="col" colspan="1" id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:j_id10header"><div id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:j_id10header:sortDiv">Congregation Account Name(Home meeting)</div></th><th class="rich-table-subheadercell " scope="col" colspan="1" id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:j_id13header"><div id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:j_id13header:sortDiv">Congregation Account ID(Home meeting)</div></th><th class="rich-table-subheadercell " scope="col" colspan="1" id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:j_id16header"><div id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:j_id16header:sortDiv">Congregation Account ID(Home meeting)</div></th></tr></thead><tbody id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:tb"><tr class="rich-table-row rich-table-firstrow "><td class="rich-table-cell " id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:0:j_id10" colspan="1">Jeffrey Hipp</td><td class="rich-table-cell " id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:0:j_id13" colspan="1">003L000000LF1xtIAD</td><td class="rich-table-cell " id="j_id0:emailTemplate:j_id3:j_id4:j_id7:j_id8:j_id9:0:j_id16" colspan="1"></td></tr><tr class="rich-table-row "><td class="rich-table-cell " id="j_id0:emailTemp
........
instead of proper table display.
What will be the reason?
Any help?
logontokartiklogontokartik
Please use <messaging:htmlEmailBody>  instead of <messaging:plainTextEmailBody> and you should be set