You need to sign in to do that
Don't have an account?
Aladdin US
Sending mass email
Hi,
I tried the below code but getting an error for mass email
public class MassEmail
{
public void SendEmail()
{
List<contact>conlist=[Select id ,lastName from contact where lastName like'S%' ];
List<Id> ids= new List<Id>();
for(Contact c:conlist)
{
ids.add(c.id);
}
EmailTemplate tem=[Select id,name from EmailTemplate where name = 'Sales: New Customer Email' limit 1];
Messaging.MassEmailMessage Email = new Messaging.MassEmailMessage();
Email.setTargetObjectIds(ids);
Email.setSenderDisplayName('System Admin');
Email.setTemplateId(tem.id);
Messaging.sendEmail(new Messaging.MassEmailMessage[] { Email });
system.debug(Email);
}
}
I tried the below code but getting an error for mass email
public class MassEmail
{
public void SendEmail()
{
List<contact>conlist=[Select id ,lastName from contact where lastName like'S%' ];
List<Id> ids= new List<Id>();
for(Contact c:conlist)
{
ids.add(c.id);
}
EmailTemplate tem=[Select id,name from EmailTemplate where name = 'Sales: New Customer Email' limit 1];
Messaging.MassEmailMessage Email = new Messaging.MassEmailMessage();
Email.setTargetObjectIds(ids);
Email.setSenderDisplayName('System Admin');
Email.setTemplateId(tem.id);
Messaging.sendEmail(new Messaging.MassEmailMessage[] { Email });
system.debug(Email);
}
}
i want mail like below
but coming as below
Thanks.