+ Start a Discussion

Single Email Limit from Apex Code - EE Edition



We are sending emails on tasks based on the task status values. As we cannot create Email Alerts for Tasks, we had to send mails through Apex code.


Here is where there is a limit of 500 emails per day for an EE Edition as per the documentation. But, it is also mentioned that this does not include the emails sent out to the users inside the org as they are internal.


Only emails sent to outside addresses are added to the count. But, in our case, we are hitting this limit even though we send out mails to internal users.


Anyone, has any idea, as to what is the basis/criteria, salesforce checks/calculates this count of emails sent from API?


Many Thanks,



How are you actually sending the email (what does the sendEmail code look like)?


In order for an email to be counted as being sent to a user, you have to be using the "setTargetObjectID()" method in the SingleEmailMessage class.  You will need to pass in a userId to the method.


Hope this helps.



Hey Jay,


Thanks for your response.


We are setting the targetObejctId to a specific userId in the To list of the mail. But one thing to note, is that we have multiple users in the To list as well as there are few additional ones in the Cc list as well.


So, we are setting the userId of one of these users in the singleEmailMessage() object.


Will that have any impact too?





Any email address in the To list will count towards the email limit (since we do not do a chack to see if an email address in teh To list is connected to a user).  All of our users should be set in the tagertObjectId field or the targetObjectIds array (if you are sending to multiple users).

Hii Cool_Devloper,

can you please check this app for avoiding  email limit in Salesforce
MassMailer lets you send unlimited emails from within Salesforce, no matter which edition you use. Built on the Salesforce platform, it has all the mass email features you’ll ever need.Build, send, and schedule professional-looking emails with a simple to use email Wizard within Salesforce – no HTML experience required.

You can try this app by installing from appexchange- MassMailer 

For Developer's Guide please click here-Developer's Guide

You can learn more details about the product on this website -Link