Skip to main content

Timeline for Query email limits in Apex code

Current License: CC BY-SA 3.0

17 events
when toggle format what by license comment
Jul 21, 2022 at 5:59 comment added Basant Kumar verma As its incorrectly merged, adding my findings here, I also faced it and was able to get it from Metadata API Salesforce Article Link: help.salesforce.com/s/articleView?id=000331939&type=1 API: GET: /services/data/v53.0/limits IN Result Check for SingleEmail or MassEmail based on your need
Oct 26, 2016 at 4:07 vote accept SfdcBat
Oct 18, 2016 at 22:17 comment added SfdcBat @SebastianKessel when i executed - system.debug('***********' + Messaging.reserveMassEmailCapacity(10)); in exe anonymous , I got an error - Line: 1, Column: 14 Arithmetic expressions are not allowed on void types.
Oct 18, 2016 at 21:49 comment added Sebastian Kessel What does "did not work" mean?
Oct 18, 2016 at 21:48 comment added SfdcBat @SebastianKessel Can I use Messaging.reserveMassEmailCapacity(count); in execute anonymous to check what I get? I tried Messaging.reserveMassEmailCapacity(10); but did not work in exe anonymous
Oct 18, 2016 at 21:13 comment added Sebastian Kessel ....Assuming you have a 5000 emails available to send.
Oct 18, 2016 at 19:04 comment added Adrian Larson You can call sendEmail once on a List that contains 5000 emails.
Oct 18, 2016 at 18:40 comment added SfdcBat Can I not call sendEmail more than 10 times in a for loop? I will be using send email method in a batch class and use send email with different email addresses(around 500 email address). I will be using sendemail in a for loop.
Oct 18, 2016 at 18:29 comment added Adrian Larson That Limits method returns how many times you can call Messaging.sendEmail, which is indeed 10. You should replace count with the number of emails to verify.
Oct 18, 2016 at 18:25 comment added SfdcBat In execute anonymous I tried executing - system.debug('*******' + Messaging.reserveMassEmailCapacity(count)); and I get - Variable does not exist: count AND when I use system.debug('***' + Limits.getLimitEmailInvocations()) I get output as 10. Why do I get 10 instead of 5000, which is the daily email limit using apex code? Any idea?
Oct 18, 2016 at 18:13 comment added Sebastian Kessel Actually, @AdrianLarson that is the wrong duplicate. In that question, the OP had a problem where he was making too many sendEmail calls within a context. In this case, the OP has a problem with the daily limit.
Oct 18, 2016 at 18:09 comment added Sebastian Kessel I am glad I am not the only one.... the solution I outlined might help him.
Oct 18, 2016 at 18:09 history edited Sebastian Kessel CC BY-SA 3.0
added 207 characters in body
Oct 18, 2016 at 18:08 comment added Adrian Larson Also the OP totally accepted the wrong answer here after I made the same mixup.
Oct 18, 2016 at 18:07 comment added Sebastian Kessel Damnit. Why don't I properly read my own links?
Oct 18, 2016 at 18:05 comment added Adrian Larson Nope. That gives you the current context limit, not the daily limit.
Oct 18, 2016 at 18:04 history answered Sebastian Kessel CC BY-SA 3.0