2

Am getting following error message 06:15:51:437 FATAL_ERROR System.EmailException: SendEmail failed. First exception on row 3; first error: SINGLE_EMAIL_LIMIT_EXCEEDED, Email limit exceeded: [].

There’s no limit on sending individual emails to contacts, leads, person accounts, Am using contact object to send an email even though it fails. Can some one help on this.

for(Invoice__c inv :(List<Invoice__c>) scope){ Id TemplateId = NULL; TemplateId = [SELECT Id,Name FROM EmailTemplate WHERE DeveloperName =: varEmailTemplateDeveloperName].Id; Messaging.SingleEmailMessage emails = new Messaging.SingleEmailMessage(); emails.setTemplateId(TemplateId); List<String> functionTypes = new List<String>(); List <contact> conLst = new List<contact>([SELECT Id, Email FROM Contact where AccountId =:inv.Student_Family_Account__c AND Email != null ]); for(contact conObj : conLst){ functionTypes.add(conObj.email); emails.setTargetObjectId(conObj.Id); } string emailStr = String.join(functionTypes, ';'); List<string> varTOSendEmails = emailStr.split(';'); emails.setWhatId(inv.Id); emails.setSaveAsActivity(false); emails.setTreatTargetObjectAsRecipient(false); emails.setToAddresses(varTOSendEmails); emailList.add(emails); } System.debug('You have made ' + Limits.getEmailInvocations() + ' email calls out of ' + Limits.getLimitEmailInvocations() + ' allowed'); Messaging.sendEmail(emailList); System.debug('111You have made ' + Limits.getEmailInvocations() + ' email calls out of ' + Limits.getLimitEmailInvocations() + ' allowed'); 
2
  • you may be able to work around this by delegating to a WFR, Process Builder, or Flow where the limit is 1000 * # org users (max 2,000,000) Commented Dec 6, 2019 at 2:14
  • Check this out: salesforce.stackexchange.com/questions/25184/… Commented Dec 6, 2019 at 4:11

1 Answer 1

3

There is a limit of 5,000 emails per day for emails sent to Lead and Contact records and emails listed in setToAddresses, setBbcAddresses, and setCcAddresses. The "no limit" on emails applies only to those sent using the User Interface.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.