• If you use SingleEmailMessage to email your org’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 addresses in setToAddresses means the email does count toward the limit
For licensed community users you don't need to worry about limits.
Hi SAHG, Limits for email and email templates are given per edition.
There’s no limit on sending individual emails to contacts, leads, person accounts, and users in your org directly from account, contact, lead, opportunity, case, campaign, or custom object pages.
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 org directly from account, contact, lead, opportunity, case, campaign, or custom object pages.
and also refer this post which has the same discussion.
https://developer.salesforce.com/forums/?id=906F00000008k1yIAA Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
The scenario I am working on is sending daily lead summary to the partner users (Of partner community using partner licenses) I have a schdulable apex works perfect but doesn't send more than 10 emails
You can use something like below according to your requirement.
In the below sample code I am iterating over a list of partner users ("lstPortalUser"). This list is created by me as per my requirement. You can create the same list as per your requirement.
List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
for(User portalUser :lstPortalUser)
{
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
string body = 'Hi '+ portalUser.LastName;
mail.setSubject('Test Subject');
mail.setTargetObjectId(portalUser.Id);
mail.setSaveAsActivity(false);
mail.setHtmlBody(body);
mails.add(mail);
}
Messaging.sendEmail(mails);
As I had mentioned in my first comment, your problem is that you are using "Mail.ToAddresses" in your code, which has very low limits. However, you should use setTargetObjectId(Set<Id> partnerUserIds) method, you will have no email limits. Here is the comment again for your reference
• If you use SingleEmailMessage to email your org’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 addresses in setToAddresses means the email does count toward the limit
So instead of creating a Map of PartnerName and sendToAddresses in your code, create a set of user id of partners and then use that in setTargetObjectIds method. This should solve the issue for you.
Here is the Email limits cheatsheet
https://na10.salesforce.com/help/pdfs/en/salesforce_app_limits_cheatsheet.pdf
Here is what you might be missing:
• If you use SingleEmailMessage to email your org’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 addresses in setToAddresses means the email does count toward the limit
For licensed community users you don't need to worry about limits.
Thanks
Anupam Bansal
OSI Consulting
Limits for email and email templates are given per edition.
There’s no limit on sending individual emails to contacts, leads, person accounts, and users in your org directly from account, contact, lead, opportunity, case, campaign, or custom object pages.
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 org directly from account, contact, lead, opportunity, case, campaign, or custom object pages.
Please refer page 24 and 25 in below link.
https://resources.docs.salesforce.com/200/10/en-us/sfdc/pdf/limits_limitations.pdf
and also refer this post which has the same discussion.
https://developer.salesforce.com/forums/?id=906F00000008k1yIAA
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
The scenario I am working on is sending daily lead summary to the partner users (Of partner community using partner licenses) I have a schdulable apex works perfect but doesn't send more than 10 emails
how to over come this?
If you can post the Email sending code over here then we should be able to help you better?
Thanks,
Anupam
You can use something like below according to your requirement.
In the below sample code I am iterating over a list of partner users ("lstPortalUser"). This list is created by me as per my requirement. You can create the same list as per your requirement.
And also please refer below link which has a full code.
http://forceguru.blogspot.com/2011/03/how-to-send-more-than-10-e-mails.html
Please let us know if this helps you.
Thanks and Regards
Sandhya
As I had mentioned in my first comment, your problem is that you are using "Mail.ToAddresses" in your code, which has very low limits. However, you should use setTargetObjectId(Set<Id> partnerUserIds) method, you will have no email limits. Here is the comment again for your reference
• If you use SingleEmailMessage to email your org’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 addresses in setToAddresses means the email does count toward the limit
So instead of creating a Map of PartnerName and sendToAddresses in your code, create a set of user id of partners and then use that in setTargetObjectIds method. This should solve the issue for you.
Thanks,
Anupam Bansal