Resolve 24 hour Apex email limit error in Salesforce

How to design and architect Salesforce application so that 24 hour Apex email limit error could be resolved and have reporting capabilities on emails sent from Salesforce

Sending email from Apex looks very interesting and powerful feature at first glance however by time your application evolves to more complex structure or more data, chances are very high that you will be hitting many Apex email limit related errors. As Salesforce is not mass email sending tool, it makes sense to have limits on total number of outgoing emails per 24 hours.

At a time of writing this post, mainly there would be two types of error while sending email from Apex as explained below

  1. Transaction based errors
    • We can send 100 emails per SingleEmailMessage
  2. Per day (24 hour) email limit
    • We can send 1000 emails per day

One point to note here that we can send unlimited emails to internal users including community users. More details on email limits can be found here (Salesforce governor limits)

I have seen multiple questions on Salesforce developer community on how to resolve error related to sending email per 24 hour in Apex. Below solution has been used by me for a long time and it is working to send thousands of email per day without any problem.

Let’s see how we can resolve this error with below design.

Resolve 24 hour Apex email limit error in Salesforce
Resolve 24 hour Apex email limit error in Salesforce

Continue reading “Resolve 24 hour Apex email limit error in Salesforce”