Reduced SingleEmailMessage limit usage
Core Unlocked Package Changes
LoggerEmailSender
Changes
- Fixed #369 by changing how failure emails are sent to the 'Apex Exception Email' recipients (shown in the screenshot below, configurable under Setup --> Apex Exception Email)
- Previously, the user ID (
ApexEmailNotification.UserId
) of Salesforce users configured as recipients (labeled as '1' in the screenshot below) was passed to the instance methodMessaging.SingleEmailMessage.setToAddresses()
, resulting in the email counting as an email to an external email address, which has an org daily limit. You can check your org's limit using this Apex snippet:System.debug(OrgLimits.getMap().get('SingleEmail'));
- Now, the user ID (
ApexEmailNotification.UserId
) is passed to the instance methodMessaging.SingleEmailMessage.setTargetObjectId()
. UsingsetTargetObjectId()
to send emails to users does not count towards the org's daily limit - External email addresses (labeled as '2' in the screenshot below, configured under Setup --> Apex Exception Email) will still count towards the org's daily email limit
- Previously, the user ID (
Installation Info
Core Unlocked Package - no namespace
Full Changelog: v4.11.10...v4.11.11
- SF CLI:
sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001Oih7QAC
- SFDX CLI:
sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001Oih7QAC
- Sandbox: https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001Oih7QAC
- Production: https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001Oih7QAC