0

I try to test bulk-scenario, but there is an error msg "System.LimitException: Too many Email Invocations: 11". Can I use MassEmailMessage or I need to use only SingleEmailMessage with adding it to the List?

  • You can only call Messaging.sendEmail 10 times per transaction, can you please share your code so that we can help you better ? – Jarvis Sep 14 '18 at 15:56
1

Yes, you can use the MassEmailMessage class, but you do need to create a list and send them all at once:

Messaging.Email[] emails = new Messaging.Email[0];
for(SObject record: someRecordList) {
  emails.add(generateEmailFor(record));
}
Messaging.sendEmail(emails);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.