0
global void finish(Database.BatchableContext BC){

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'my mail id'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('some mail id');
mail.setSenderDisplayName('Lavanya');
mail.setSubject('Batch Process Completed');
mail.setPlainTextBody('Batch Process has completed');

}
  • I added that but still it's not working. Is any permissions needed in My org to send Email. – Lavanya Nov 23 '16 at 8:52
2

There is missing:

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

Unless it is just mistake pasting code this is the issue

  • I added this line, but it's showing an error COMPILE ERROR: Initial expression is of incorrect type, expected: Messaging.SingleEmailMessage LINE: 9 COLUMN: 58 – Lavanya Nov 23 '16 at 9:08
  • My bad, i've pasted line for mass email... Now it should be ok :) – Artur Kępczyński Nov 23 '16 at 9:10
  • @Lavanya if this answer is the corect one, please mark it as accepted (click the checkmark below the arrows and number) – Fernando Gavinho Nov 23 '16 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.