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');
1000 * # org users (max 2,000,000)