I tried googling but couldn’t find a clear answer to what all emails that are sent from Salesforce count against the SingleEmailLimit of 5000 per day. Does workflow rule e-mail alerts count against this limit? If we have multiple additional addresses would that count against the limit too ? Thanks in advance.
1 Answer
All emails sent using the following count towards the daily limits (in Apex):
- passing an email address or object ID through:
- setToAddresses
- setCcAddresses
- setBccAddresses
This is covered in the SingleEmailMessage.setToAddresses documentation:
Optional. A list of email addresses or object IDs of the contacts, leads, and users you’re sending the email to. The maximum size for this field is 4,000 bytes. The maximum total of toAddresses, ccAddresses, and bccAddresses per email is 150. All recipients in these three fields count against the limit for email sent using Apex or the API.
Emails sent to Users (and perhaps Leads), by ID, using the following do not count:
- setTargetObjectId
This is covered obliquely in the governor limits documentation:
If you use SingleEmailMessage to email your org’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email addresses in setToAddresses means the email does count toward the limit
Here it literally means User IDs. Contacts, for example, count towards limits.
See also this previous Q&A.
In terms of workflow alerts, these have their own limits as covered here. I believe all email alerts count except where explicitly excluded in that same article.