I have increased the limit of single email messages in one of my test orgs to 500 via creating a case with salesforce. My problem is that I am still not able to send out more than 50 to 60 mails. The mails sent as
setTargetObjectId(userId)
setSaveAsActivity(false)
My functionality is that on some specific actions of a user in my application, an email to other users is triggered by using the SingleEmailMessage object. These emails are all added in a list of Messaging.SingleEmailMessage and the sendEmail method is called only once per transaction.
What I am not able to figure out is that why the mails stop coming after 50 to 60 emails. If i check the debug logs I do see the EMAIL_QUEUE
entry. There is no record of the mails in the Emails logs if I download them
I want to know is there a fair usage policy that salesforce enforces if it sees too many emails going out, since I see that the limits are still there (looking into the limits url in the workbench REST explorer)
Update :
List<Messaging.SingleEmailMessage> mailList=new List<Messaging.SingleEmailMessage>();
for(CustomObject__c c : someList)
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSubject('Some sample subject');
mail.setHtmlBody('some sample email body');
mail.setTargetObjectId(c.user.Id);
//user is an object of User in salesforce mail.setSaveAsActivity(false);
mailList.add(mail);
}
List<Messaging.SendEmailResult> results = Messaging.sendEmail(mailList);