function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GennadiyGennadiy 

Daily email limit on Developer Edition

Hello.

I'm trying to understand what happened with daily email limit on Developer Edition. About a year ago our team worked on the specific feature which generates hundreds of emails and sends them to internal SF users using SingleEmailMessage and its setTargetObjectId method. I remember that everything worked perfectly on Developer Edition, Sandbox and PRD (we even were able to send some thousands of emails without any problems and limits).

As of now, we're working on another feature which should generate and send many emails too. But we found that SF can't send hundreds of emails now on our Developer Edition.

I've tried to analyze the problem, but didn't find the reason:
- there are no any exceptions in logs;
- when I look at a log it says: "EMAIL_QUEUE" (email is queued);
- I even tried to reserve email capacity using the code like this Messaging.reserveSingleEmailCapacity(numberOfEmails);, but didn't get any exceptions (limit is still free).
Everything works correctly, but emails are not sent to SF users.

So, my questions:
1) is there a specific limit for emails on Developer Edition? If it's true, then what is the daily limit?
2) did I miss something in the SF documentation? I considered this description:
If you use SingleEmailMessage to email your organization’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email addresseses in setToAddresses means the email does count toward the limit.


I'm providing a test code for those who want to check it on his Developer Edition:
//1) generate and send emails
List<Messaging.SingleEmailMessage> messages = new List<Messaging.SingleEmailMessage>();
final Integer NUMBER_OF_EMAILS = 300;
for (Integer index = 0; index < NUMBER_OF_EMAILS; index++)
{
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
    email.setTargetObjectId(UserInfo.getUserId());
    email.setSubject('Test : ' + index);
    email.setPlainTextBody('test');
    email.saveAsActivity = false;
    messages.add(email);
}
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages, false);

//2) print the results
for (Messaging.SendEmailResult result : results)
{
    System.debug(result);
}
James LoghryJames Loghry
Per this document: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm#email_limits_section

"In Developer Edition organizations and organizations evaluating Salesforce during a trial period, your organization can send mass email to no more than 10 external email addresses per day. This lower limit does not apply if your organization was created before the Winter '12 release and already had mass email enabled with a higher limit. Additionally, your organization can send single emails to a maximum of 15 email addresses per day."

Between that and using the System.Limits Apex methods for Email Invocations (see here: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_limits.htm) , you should have a good idea of how many emails you're sending / how many emails you're allowed to send.
Henry AkpalaHenry Akpala
You can follow the link below   
https://na10.salesforce.com/help/pdfs/en/salesforce_app_limits_cheatsheet.pdf
Page 37
Below is a copy of the text from the page, you can check the link for additional details.

Email Limits
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.
When sending single emails, keep in mind:
You can send 100 emails per SingleEmailMessage.
• If you use SingleEmailMessage to email your organization’s internal users, specifying the user’s ID in
setTargetObjectId means the email doesn’t count toward the daily limit. However, specifying internal users’ email
addresseses in setToAddresses means the email does count toward the limit.


Hope this helps

GennadiyGennadiy
Thank you for a quick response, James.

But I'm not sure your links explain the reason:
1) I do not try to send my emails using many external email addresses. The provided code tries to send all emails to SF User via setTargetObjectId method. So, it looks like the limit of 15 emails is not applied for my situation (by the way, first time I executed the code above, it sent about 140 emails. It's much more than 15, but it had to send 300 emails);
2) I can also see this text in the documentation: You can send an unlimited amount of email to your organization’s internal users, which includes portal users.
3) Limits class does not provide any methods which tell me how many emails I can send. There is a couple of methods which work with the number of email invocations that have been called (it's about calling of 'sendEmail' method only).
GennadiyGennadiy
Thank you, Henry.

I saw this part of the documentation too and please let me explain how I understand it.

We can send 100 emails per SingleEmailMessage. For me it means that we can't send more than 100 emails using one instance of SingleEmailMessage object. There is another known fact is that we can't set more than 100 addresses using setToAddresses(String[]) method (). So, I think this limitation is for an instance of SingleEmailMessage object only.

But my code creates a separate SingleEmailMessage object for an every email (1 email = 1 SingleEmailMessage object) and then sends a list of emails using Messaging.sendEmails method. And I can't find any limitations for a number of SingleEmailMessage object which can be passed in sendEmails method (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_outbound_messaging.htm#apex_System_Messaging_sendEmail).

What do you think about this?
GennadiyGennadiy
Guys, do you have any other thoughts?
Amar SinghAmar Singh
Well, i faced the simiar issue once and figured it out.

I was using yahoo mail for my Developer Edition. I was not able to send email neither i was getting any error or exceptions.

But when i requested Email logs for Recipient Email Addressit says:
550-5.7.1 Unauthenticated email from yahoo.com is not accepted due to domain's\r\n550-5.7.1 DMARC policy. Please contact administrator of yahoo.com .

I changed My Developer Edition's email address to gmail email address and now the same code is working fine.

I hope this helps!!!

Thanks
Amar
GennadiyGennadiy
Hi Amar. Thank for your post.

I don't think the described issue is related with a email address of my account (by the way, I used Google address too). This is simply a limitation of Developer editions: you can send about 50 emails per a day via Apex code there, all other emails will be correctly queued, but will not be sent by SF. Again, there are no errors in the log, everything works as expected except the fact that SF does not send emails.

Just for interest, have you tried to execute my code? I tried it one more time today in my DE org: it works without errors and all 300 emails were queued, but only 50 of them were really sent/delivered to my address.