You need to sign in to do that
Don't have an account?
Avin
Too many email invocation: 11
Hi,
I have written a batch class. In SingleEmailMessage, I have defined the To address and list of CC address.
CC address is equal to the number of contacts present in Account.
In schedule class, Batch Size of 1 is defined.
But I am getting the Error: Too many Emal invocation 11.
Please help me get the solution of this problem
Thanks,
I faced a similar issue & the below topic had the solution for it:
http://boards.developerforce.com/t5/General-Development/Scheduling-Apex-Batch-with-Callouts-Future-method-cannot-be/td-p/289527
HI,
Do not call sendEmail() method inside for loop,You need to create a list of "SingleEmailMessage" and add the SingleEmailMessage instance to that particular list.Then outside the for loop call sendEmail() method with that list.
As:
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
for( Contact con : conList ) {
Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
/**** Add to,cc,body,subject etc. in message.****/
mails.add(message);
}
Messaging.sendEmail(mails);