Skip to main content
added 207 characters in body
Source Link
Sebastian Kessel
  • 13.2k
  • 12
  • 38
  • 61

TheUPDATED ANSWER:

Turns out, the Limits class is now what you need. I'll go back to what I used to do.

You can use Messaging.getLimitEmailInvocationsreserveMassEmailCapacity(count);. This call should givewill result in an error if you don't have enough capacity. It's not exactly what you needasked, but it could do the trick in your case. More info on limits

Reference: herehttps://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_forcecom_email_outbound.htm

Also, vote the idea that would expose this limit via the class above: https://success.salesforce.com/ideaView?id=08730000000aSLLAA2

The Limits.getLimitEmailInvocations() call should give you what you need. More info on limits here

UPDATED ANSWER:

Turns out, the Limits class is now what you need. I'll go back to what I used to do.

You can use Messaging.reserveMassEmailCapacity(count);. This call will result in an error if you don't have enough capacity. It's not exactly what you asked, but it could do the trick in your case.

Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_forcecom_email_outbound.htm

Also, vote the idea that would expose this limit via the class above: https://success.salesforce.com/ideaView?id=08730000000aSLLAA2

Source Link
Sebastian Kessel
  • 13.2k
  • 12
  • 38
  • 61

The Limits.getLimitEmailInvocations() call should give you what you need. More info on limits here