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
sfdc freshersfdc fresher 

created Mass Email and sent to 2 contacts.But unable to see that email template in those targetted Objects

hi all,
I have written below code.I am getting success response but unable to see the eMAIL template in the contacts that are targetted. Could anyone please look into this?
public class MassEmailMessagingApex{
    

    public void SendEmail() {
   List<contact> lstcon=[Select id from contact limit 2];
   List<Id> lstids= new List<Id>();
   for(Contact c:lstcon) {
  lstids.add(c.id);
 }
 EmailTemplate et=[Select id from EmailTemplate where name = 'CourseName_Fee' limit 1];
 
 Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
 mail.setTargetObjectIds(lstids);
 mail.setSenderDisplayName('System Admin');
 mail.setTemplateId(et.id);
 Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
}
    }
sfdc freshersfdc fresher
do we have any other approach to achieve this? could anyone please guide me