global class EmailAcknowledgment implements Schedulable
{
public List<Contact> contactList{get;set;} //
public List<String> contactEmail{get;set;}
public Map<string,string> contactMap{get;set;}
global void execute(SchedulableContext ctx)
{
// TODO: your code here
contactList=new List<Contact>();
contactEmail =new List<String>();
contactList.clear();
contactEmail.clear();
contactList=[select id,Email,Name,Date__c from Contact where Date__c !=:system.today()];
contactMap =new Map<string,string>();
for(Contact u:contactList)
{
system.debug('_____________id______'+u.id+'___________Email______________'+u.Email+'_________DATE______________________________________'+u.Date__c);
contactMap.put(u.id,u.Email);
if(u.Email!=null)
contactEmail.add(u.Email);
}
if(contactEmail.size()>0)
sendmail(contactEmail);
}
public void sendmail(List<String> str)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
string [] toaddress=str;
String[] ccAddresses=new String[]{'allwin.joshi@kvpcorp.com'};
email.setSubject('Mass Email');
email.setHtmlBody('Dear Sir /Madam,<br/><br/> Hello,<br></br> Your Profile is Created !!!<br/><br/>Sincerely,<br><br/><br/>Date :'+string.valueof(system.today()));
email.setToAddresses(toaddress);
email.setCcAddresses(ccAddresses);
Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});
}
}