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
subbu123.pbt@gmail.comsubbu123.pbt@gmail.com 

Send Mass Email through Apex

How to send 100 emais at a time by using apex. ple can any one send me full code ....

souvik9086souvik9086

List<Contact> conObj = [SELECT id, name FROM Contact LIMIT 100];

EmailTemplate e =  [select id,name from EmailTemplate limit 1];

for(Integer i=0; i < conObj.size(); i++){

Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
List<Messaging.Emailfileattachment> fileAttachments = new List<Messaging.Emailfileattachment>();
email.setTargetObjectId(conObj[i].Id);
email.setTemplateId(e.id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });

}

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

subbu123.pbt@gmail.comsubbu123.pbt@gmail.com

thank u , and one more is Batch apex real time code send me ple...........

and small description like importance of each method ok

 

I have Doubts in Batch Apex:

1. which method execute fisrt  ?

2.relation b/w start and execute method ?

3.importance for finish method.

souvik9086souvik9086

Hi,

 

You can get all those you want regarding batch apex here

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks