EmailAcknowledgement


SUBMITTED BY: Guest

DATE: Jan. 22, 2014, 12:16 p.m.

FORMAT: Text only

SIZE: 1.7 kB

HITS: 4579

  1. global class EmailAcknowledgment implements Schedulable
  2. {
  3. public List<Contact> contactList{get;set;} //
  4. public List<String> contactEmail{get;set;}
  5. public Map<string,string> contactMap{get;set;}
  6. global void execute(SchedulableContext ctx)
  7. {
  8. // TODO: your code here
  9. contactList=new List<Contact>();
  10. contactEmail =new List<String>();
  11. contactList.clear();
  12. contactEmail.clear();
  13. contactList=[select id,Email,Name,Date__c from Contact where Date__c !=:system.today()];
  14. contactMap =new Map<string,string>();
  15. for(Contact u:contactList)
  16. {
  17. system.debug('_____________id______'+u.id+'___________Email______________'+u.Email+'_________DATE______________________________________'+u.Date__c);
  18. contactMap.put(u.id,u.Email);
  19. if(u.Email!=null)
  20. contactEmail.add(u.Email);
  21. }
  22. if(contactEmail.size()>0)
  23. sendmail(contactEmail);
  24. }
  25. public void sendmail(List<String> str)
  26. {
  27. Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
  28. string [] toaddress=str;
  29. String[] ccAddresses=new String[]{'allwin.joshi@kvpcorp.com'};
  30. email.setSubject('Mass Email');
  31. 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()));
  32. email.setToAddresses(toaddress);
  33. email.setCcAddresses(ccAddresses);
  34. Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});
  35. }
  36. }

comments powered by Disqus