My organization sends emails via Apex single email in some cases, We are sending the mails to users whenever possible, but sometimes we need to send to external mail, that's causing us to use the 1000 single email limit. Recently We are having issues of passing this limit which causes email not to be sent, or code to fail.

Except from the workbench, Is is possible to get the remaining single emails limit we've left?

The idea is to create an alert whenever the limit is approaching its limit, Any Other ideas will also be great

2 Answers 2


Yes, you can use the System.Limits class from Apex. Here is a link to the System Limits documentation.

//This is how many email calls have been made
//This is how many in total are allowed  

Your code can look at these two numbers to work out if you are getting close to the threshold and to act accordingly.


Another pattern you can use is the following

try {
    ... send email(s)
catch (System.HandledException) {
    .. alert user and say try again next day ...or
    .. alert sysad and use an async pattern to queue for next day to retry
  • But how would you access that from workbench? You'd need to use Apex REST, no?
    – Adrian Larson
    Aug 18, 2016 at 17:46
  • @AdrianLarson - you wouldn't use the above from Workbench - only from apex code which is what I gathered from the OP is the essence of the issue - avoid sending out emails when there is no capacity to do so. Doug B had a reasonable solution as well
    – cropredy
    Aug 18, 2016 at 19:36
  • Except his solution does not tell you anything about how many emails you can still send, only how many invocations of sendEmail remain. See also: salesforce.stackexchange.com/questions/137203/…
    – Adrian Larson
    Aug 18, 2016 at 19:38
  • The OP certainly seems to be looking for a way to access this information via the workbench.
    – Adrian Larson
    Aug 18, 2016 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .