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
AnonTestQuestAnonTestQuest 

Array of emails in batch question

I have a batch that sends out an email but it needs to send the email to only the people that fit the criteria created and each email contains a link specific to that person (a record they own). How should I do this with an array?
Shailendra Singh ParmarShailendra Singh Parmar
Hi Their,
I think you can use apprach that is discussed at http://www.sfdc99.com/2014/03/01/sending-emails-using-apex/. What he is doing is
  1. Creating List of Messaging.SingleEmailMessage that include receipant in your case you will not add them in array instead create list of 
    Messaging.SingleEmailMessage
     
  2. After a loop he is calling Messaging.sendEmail(mails) to send email.