2

My customer complained he got the following error message:

SendEmail failed. First exception on row 0; first error: SINGLE_EMAIL_LIMIT_EXCEEDED, Failed to send email: []

Our apex code sends a single email address to a specified email (defined by the customer). Apparently the customer needed to repeat this operation a few times before he got this error message.

It seems that there is a limit of the amount of single emails being able sent in a single day.

Is it possible to remove this limit?

3 Answers 3

3

There is a limit on the number of emails you can send from Apex, this is 1,000 per 24 hours and you would need to raise a case and engage with Salesforce to get this raised.

I think that the error message you are seeing there refers to a different limit, which is that you can only call sendEmail 10 times within the same context. Is it possible that your apex code is calling that in a loop?

sendEmail can be called on an array of messages, so rather than call it once you should build up an array of singleemailmessage and then send them all in one call.

6
  • Hi Doug, the user used the same email address a few times (between 8-10). In the apex I use SendSingleEmail. Maybe there is a limit of sending an email to the same address more than 10 times?
    – Uri Lukach
    Aug 6, 2013 at 12:42
  • You can only use the method sendEmail 10 times within a single execution context. That's a hard limit. You can quite easily send more than 10 messages by building an array of messages to send and then calling sendEmail once with the full array. Do you really want to be sending 10 emails to the same email address?
    – Doug B
    Aug 6, 2013 at 13:16
  • Hi Doug, it is really up to the customer to decide... I wonder what exactly do you mean by "execution context" ?
    – Uri Lukach
    Aug 6, 2013 at 13:29
  • Well, how does the customer initiate the sending? If it is from a visualforce page command button, then the context starts when the controller code starts (e.g. after the user presses a button) and finishes when the pagereference is returned. Each time they press the button this executes in a new context. Are you sure that you are clearing out any list of sent messages between events?
    – Doug B
    Aug 6, 2013 at 13:37
  • 1
    Uri: it probably depends on how exactly you're sending those emails in your code. Is the sendEmail() method being called just once (at the end), or more than once (maybe inside a loop)? Aug 6, 2013 at 23:52
2

Also note you will get this error in a newly refreshed sandbox, if you try and make an Apex message call, as sandboxes by default have a new setting on Email Deliverability, set to 'System Email Only'

In the sandbox you need to go to Admin Setup -> Email Admin -> Deliverability, and change the access level to All Email.

This will affect sending of Apex-triggered email messages, you will get an error as above.

1
  • 1
    That's a good point and catches a lot of people out. Although in this case if the customer is reporting that the email function works at first, this is probably not the problem.
    – Doug B
    Aug 8, 2013 at 8:57
0

Salesforce limits are described here: https://login.salesforce.com/help/doc/en/salesforce_app_limits_cheatsheet.pdf

Using the API or Apex, you can send single emails to a maximum of 1,000 external email addresses per day based on Greenwich Mean Time (GMT). Single emails sent using the Salesforce application don’t count toward this limit.There s no limit on sending individual emails to contacts, leads, person accounts, and users in your organization directly from account, contact, lead, opportunity, case, campaign, or custom object pages

With business justification I have had this limit raised to 2000 per day, but you need to ensure you are not using Salesforce as a bulk email distribution platform. Our use case was a custom email composition window which required the emails to be sent via Apex.

The other Salesforce limits are described here: https://login.salesforce.com/help/doc/en/salesforce_app_limits_cheatsheet.pdf

1
  • So why is the user limited to 10 emails? is it because he used the same email address? how would you solve this issue?
    – Uri Lukach
    Aug 6, 2013 at 13:01

You must log in to answer this question.

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