You need to sign in to do that
Don't have an account?
Gaurav Agnihotri
Send email to multiple users.
Hi,
I have created a batch apex job and want to send emails to all the team members when the job is completed. Right now, I am only able to send one email. I intend to send emails to all the team members. Below is the class that I have created.
Thanks,
Gaurav
I have created a batch apex job and want to send emails to all the team members when the job is completed. Right now, I am only able to send one email. I intend to send emails to all the team members. Below is the class that I have created.
global class batchPPBInsert implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext BC) { //Query Record } global void execute(Database.BatchableContext BC, List<Pelco_Price_Book_Stage__c> scope) { //execute db operation } global void finish(Database.BatchableContext BC) { String email; email='gagnihot@gmail.com'; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setToAddresses(new String[] {email}); mail.setReplyTo('gagnihot@gmail.com'); mail.setSenderDisplayName('Batch Processing'); mail.setSubject('Batch Process Completed'); mail.setPlainTextBody('Batch Process has completed'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); } }
Thanks,
Gaurav
Hi Gaurav,
You can pass the list of email ids in setToAddresses
Let me know if that works for you.
Thanks,
Himanshu
All Answers
Hi Gaurav,
You can pass the list of email ids in setToAddresses
Let me know if that works for you.
Thanks,
Himanshu
Thanks