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
BigPBigP 

How to send email to a list of contacts randomly?

Vanaja MadiReddyVanaja MadiReddy
Hi, Enea Rushiti 
EmailTemplate templateId = [Select id from EmailTemplate where name = 'Your template Name']; List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>(); for(contact con : contactList) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setTemplateID(templateId.Id); mail.setTargetObjectId(con>id) mail.setSaveAsActivity(false); allmsg.add(mail); } Messaging.sendEmail(allmsg,false);

Basically add all contact in the list and then send them in single shot. In one time you can send 100 emails. So this will solve your problem.
l Hope This Is Usefull to U give me a Remark

Thank you
Vanaja Madireddy


 
Chro mst120Chro mst120
Are you Looking for Virginia Dominion Power Login then check here Virginia Dominion Power Login Official portal. You can also know more about how to reset the  Virginia Dominion Power Login password and many more.

Visit here:Virginia Dominion Power Login (https://power-login.info/virginia-dominion-power-login/)
Daniel Matthew 8Daniel Matthew 8
Thanks, that was a really cool read smartcric (https://apnewscorner.com/smartcric/)!