You need to sign in to do that
Don't have an account?

How to ensure emails to internal users do not count against email limts?
We send numerous emails to numerous internal Salesforce users for things like job failures in Apex. We always assumed that setting the toAddresses() field to the email address of an internal user (ie. first.last@mycompany.com) would qualify as an internal email. After hitting some limits, I'm questioning that assumption. It appears that sending an email like this will still qualify as an external email even though there is a internal Salesforce user with that email. Can someone please confirm?
Should we instead use setTargetObjectId(internalUserId) to guarantee the email as counted as an internal address and will not count against our limit? If so, how do we send to numerous internal users at the same time? Messaging.SingleEmailMessage only has the singular method setTargetObjectId() and not the plural version setTargetObjectIds().
Any clarification is appreciated.
Andrew
Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage(); emailMsg.setTargetObjectId(internalUserId); //must be false if sending to internal user emailMSg.saveAsActivity = false; emailMsg.setSenderDisplayName('sender name'); emailMsg.setSubject('some subject'); emailMsg.setBccSender(false); emailMsg.setUseSignature(false); emailmsg.setPlainTextBody('email body'); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { emailMsg });
I believe that's correct. You'll have to create multiple copies of the email and set the target object ID to each recipient user. You can send several mails at once, just add them all to a List<SingleEmailMessage>.
All Answers
I believe that's correct. You'll have to create multiple copies of the email and set the target object ID to each recipient user. You can send several mails at once, just add them all to a List<SingleEmailMessage>.