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
balaji Jayararmanbalaji Jayararman 

Contact id count against single email limit

Hi,

In Salesforce documentation, i read contact id does not count against email limitation. But it does counting.

Please refer the below code:
Messaging.SingleEmailMessage[] lst_EmailMsg = new List<Messaging.SingleEmailMessage>();
for (contact con : [SELECT Id from Contact where Email like '%ABC%']) {
	Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
	mail.setTargetObjectId(con.ID);
	mail.setSubject('TEST subject');
	mail.setPlainTextBody('test');
	mail.setHtmlBody('test');
	lst_EmailMsg.add(mail);
}
Messaging.SendEmailResult[] lst_EmailResults = Messaging.sendEmail(lst_EmailMsg, false);

 
Deepak DineshDeepak Dinesh
Hi Balaji,

I guess only the setTargetObject set against only User will not be counted towards email limits per day.

Please see the salesforce Documentation : Emails sent using 'setTargetObjectId()' set against the User object do not count against the 'SingleEmailMessage' limit.

Reference to the above mentioned link, https://help.salesforce.com/articleView?id=000323568&language=en_US&type=1&mode=1.

Please let me know if this answers your query.