[**Why am I getting 'Too Many API email invocations 11' error message?**][1]
> **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
[1]: https://help.salesforce.com/apex/HTViewSolution?id=000003864&language=en_US