error

System.LimitException: Too many Email Invocations: 11

What does this error mean?

Salesforce enforces a governor limit of 10 email sendEmail() calls per Apex transaction.

If your code attempts to send emails more than 10 times in a single transaction, Salesforce throws the Too many Email Invocations error.

Common Causes

1. Sending emails inside loops

Calling Messaging.sendEmail() for every record inside a loop can quickly exceed the governor limit.

2. Multiple automation processes sending emails

Triggers, flows, and workflows may all send emails within the same transaction.

3. Recursive triggers

Recursive triggers may repeatedly send emails when records update multiple times.

How to Fix It

Solution 1 — Send emails in bulk

Apex

List emails = new List();

for(Account acc : accounts){

    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
    email.setToAddresses(new String[]{'test@example.com'});
    email.setSubject('Notification');
    email.setPlainTextBody('Account created');

    emails.add(email);

}

Messaging.sendEmail(emails);

Solution 2 — Avoid email calls inside loops

Always collect email messages first, then send them in a single Messaging.sendEmail() call.

Solution 3 — Use asynchronous processing

Apex

System.enqueueJob(new SendEmailQueueable());
lightbulb

Pro Tip: Always bulkify email logic in Apex triggers to prevent exceeding the governor limit.