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?

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

1 Answer 1

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);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .