Print this page

Why am I getting 'Too Many API email invocations 11' error message?

Knowledge Article Number 000003864

Users can encounter the error "Too Many API email invocations 11" when sending emails via Apex.


There is no 10 email limit from Apex. The limit is on the number of times the SendEmail() method can be invoked from Apex. We need to ensure that we are not calling SendEmail() method inside a for loop.


Sample code:


Following is partial sample code showing how you can do it:

//method to send mail to a list of users

public static void DispatchEmail() {

    List lstMails = new List();

      lst = 20;

       for(Integer i : lst) {

          Messaging.SingleEmailMessage message = getEmail();       

 //Construct the email message here by populating the values such as body, subject

                //Adding emails to the list       



   //Sending the email list in a single call.




public static Messaging.SingleEmailMessage getEmail() {

    Messaging.SingleEmailMessage mailMessage = new Messaging.SingleEmailMessage();


    return mailMessage;



promote demote