+ Start a Discussion
sfdc freshersfdc fresher 

send the email to related contacts of accounts in batch as part of Finish method

Hi all,

I have a requirement like: Whenever the Accounts are updated , related contacts should get the mail from Finsh method in Batch apex.

Could you please help me in this. 

Padmavathi Ch
NagendraNagendra (Salesforce Developers) 
Hi Padmavathi,

May I suggest you please check with below link from the forums community with a similar discussion which might help. Please let us know if this helps.

Kindly mark this as solved of the reply was helpful.

sfdc freshersfdc fresher
am using below code, email sent to targedtted contacts,but unable to see Email temple for that contacts.Where can I check these contacts?

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) {
 EmailTemplate et=[Select id from EmailTemplate where name = 'CourseName_Fee' limit 1];
 Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
 mail.setSenderDisplayName('System Admin');
 Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });