function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew Reyes 3Matthew Reyes 3 

Messaging.sendEmail list size limit

What is the maximum list size I can pass to Messaging.sendEmail(list<SingleEmailMessage>)?  I'm sending the email to internal users by specifying their userId using setTargetObjectId, so daily limits shouldn't be a factor.
pconpcon
According to the governor limits [1] the max number of emails in the SingleEmailMessage list is 100 per sendEmail call and 10 sendEmail calls per transaction.

[1] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm#email_limits_section
Matthew Reyes 3Matthew Reyes 3
pcon, I appreciate the quick response.

The docs say we are allowed to send 100 emails per SingleEmailMessage (implying use of the setToAddresses function), but isn't specific about how many SingleEmailMessage objects we can pass to a single sendEmail call.  In this instance, each SingleEmailMessage will only have 1 email since i'm leveraging setTargetObjectId instead of setToAddresses.
pconpcon
My guess would still be that the limit is 100 emails.  Easiest way it to update a bunch of user emails to point to yours* in a Sandbox and see what happens with 101 userIds.

* The email spec says you can use + as part of your email and anything after the plus will be ignored in respects to routing.  So bob+test1@example.com, bob+test2@example.com, bob+test3@example.com are all unique emails but will all get delivered to bob@example.com.  This is very useful for testing this type of thing.
Venkata Shiva Koushik RachapudiVenkata Shiva Koushik Rachapudi
So Matthew have you got your answer for this question? i am curious as i need to send an email after a batch delete with Name and Email Ids of the said deleted records, i would want to know how many values can we view as i can only see for first 9 values in list. rest followed with '......'
Matthew Reyes 3Matthew Reyes 3
I didn’t test the upper-bound for the sendEmail method. I created a batch job to send the emails instead.