Notes
public class SendEmailByEmailTemplate {
public static void SendEmail(){
Contact Contact =[SELECT Id, FirstName, LastName FROM Contact LIMIT 1];
Map<String, String> replacements = new Map<String, String>();
replacements.put('{!Contact.FirstName}' , Contact.FirstName);
replacements.put('{!Case.CaseNumber}' ,'CS00000001');
String emailBody = EmailTemplateUtility.ReplaceVariablesInEmailTemplate('SupportCaseCreatedPhoneInquiries',replacements );
System.debug(emailBody);
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[] {'eb@gmail.com'});
mail.setSubject('TEST');
mail.setHtmlBody(emailBody);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
}
}
public class SendEmailByEmailTemplate {
public static void SendEmail(){
Contact Contact =[SELECT Id, FirstName, LastName FROM Contact LIMIT 1];
Map<String, String> replacements = new Map<String, String>();
replacements.put('{!Contact.FirstName}' , Contact.FirstName);
replacements.put('{!Case.CaseNumber}' ,'CS00000001');
String emailBody = EmailTemplateUtility.ReplaceVariablesInEmailTemplate('SupportCaseCreatedPhoneInquiries',replacements );
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[] {'enginsalesforce@gmail.com'});
mail.setSubject('TEST');
mail.setHtmlBody(emailBody);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
}
}