+ Start a Discussion
SAHG-SFDCSAHG-SFDC 

Send emails to partner Queue Members

How do I send an email to the partner Queue members using Apex?  Every memeber of that queue should get an email that a lead has been assigned to their queue and other memebers from other queues should not get nay notifications
doravmondoravmon
1.get the list you need to update: List<AA> needSendEmail
List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
for(AA n in needSendEmail)
{
    Messaging.SingleEmailMessage msg = new Messaging.SingleEmailMessage();
  
    //Set up the details for email, you can do something like the example in :
      https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm
 
     emails.add(msg);

try 
{
      Messaging.sendEmail(emails,false);
  }
catch(Exception ex)
 {

}
SAHG-SFDCSAHG-SFDC
Hi Doravmon,

I am trying to use a template and set a template ID, and then send an email

Thanks for replying
doravmondoravmon
Let me know if you get it work ~^_^
SAHG-SFDCSAHG-SFDC
Actually  not, 

I am trying to look at the syntax and the way to do it

I have to use an existing template to do so 

Need assistance