Skip to main content
added 1 character in body
Source Link
Ratan Paul
  • 22.9k
  • 14
  • 59
  • 100

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method only 10 times only.

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop(see below example)

then this method will invoke only once this way you can solve your issue


Updates

you code will be like this.

take a variable

List<Messaging.SingleEmailMessage> lstmail = new List<Messaging.SingleEmailMessage>(); //your for loop for(//your code here) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); //rest of your code lstmail.add(mail );//add into list } Messaging.sendEmail(lstmail); //invoke here 

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop(see below example)

then this method will invoke only once this way you can solve your issue


Updates

you code will be like this.

take a variable

List<Messaging.SingleEmailMessage> lstmail = new List<Messaging.SingleEmailMessage>(); //your for loop for(//your code here) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); //rest of your code lstmail.add(mail );//add into list } Messaging.sendEmail(lstmail); //invoke here 

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method only 10 times.

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop(see below example)

then this method will invoke only once this way you can solve your issue


Updates

you code will be like this.

take a variable

List<Messaging.SingleEmailMessage> lstmail = new List<Messaging.SingleEmailMessage>(); //your for loop for(//your code here) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); //rest of your code lstmail.add(mail );//add into list } Messaging.sendEmail(lstmail); //invoke here 
added 452 characters in body
Source Link
Ratan Paul
  • 22.9k
  • 14
  • 59
  • 100

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop(see below example)

then this method will invoke only once this way you can solve your issue


Updates

you code will be like this.

take a variable

List<Messaging.SingleEmailMessage> lstmail = new List<Messaging.SingleEmailMessage>(); //your for loop for(//your code here) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); //rest of your code lstmail.add(mail );//add into list } Messaging.sendEmail(lstmail); //invoke here 

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop

then this method will invoke only once this way you can solve your issue

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop(see below example)

then this method will invoke only once this way you can solve your issue


Updates

you code will be like this.

take a variable

List<Messaging.SingleEmailMessage> lstmail = new List<Messaging.SingleEmailMessage>(); //your for loop for(//your code here) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); //rest of your code lstmail.add(mail );//add into list } Messaging.sendEmail(lstmail); //invoke here 
added 9 characters in body
Source Link
Ratan Paul
  • 22.9k
  • 14
  • 59
  • 100

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add afteroutside of your for loop

then this method will invoke only once this way you can solve your issue

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add after your loop

then this method will invoke only once this way you can solve your issue

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

Resolution:

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.

In a single transaction you can invoke singleEmail message send method 10 times only

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 

If you just remove this line and add outside of your for loop

then this method will invoke only once this way you can solve your issue

Source Link
Ratan Paul
  • 22.9k
  • 14
  • 59
  • 100
Loading