This is my Visual force email template :
Controller
public class casetemplate{
public id accountid{get;set;}
public list<case> getcases(){
List<case> caselist= [SELECT CaseNumber,Description,ContactEmail,ContactMobile,ContactPhone,CreatedDate,OwnerId FROM Case where accountid =:accountid ];
return caselist;
}
}
Component
<apex:component controller="casetemplate" access="global">
<apex:attribute name="accttid" type="id" description="Id of account" assignTo="{!accountid}"/>
<table>
<tr>
<td>Case Number</td>
<td>Case Description</td>
</tr>
<apex:repeat value="{!cases}" var="c">
<tr>
<td>{!c.casenumber}</td>
<td>{!c.description}</td>
</tr>
</apex:repeat>
</table>
</apex:component>
Email Template
<messaging:emailTemplate subject="Case Description :Case.description Created Date : Owner :" recipientType="Contact" relatedToType="account">
<messaging:htmlEmailBody >
<br>This is the list of cases for your account {!relatedto.name}</br>
<br><c:Casecontacttemplate accttid="{!relatedto.id}"/></br>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
I want my email subject to dynamically populate Case Description : ,Created Date : ,Owner : ,fields from case .So this is what my subject of email template should look like
Case Description : Issue with EMail Template ,Created Date :5/5/2017 ,Owner :Natasha williams