public class testemail{
public testemail(){
}
private final Contact con;
public testemail(ApexPages.StandardController controller){
this.con=(Contact)controller.getRecord();
}
//email with pre-defined template
public void SendEmail(){
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId('00390000005ZYTI');
mail.setTemplateId('00X90000000q89B');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
/*public static void SendEmail(){
User usr=[Select Email from User where id='00590000000hrH9'];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[] {usr.Email});
mail.setSubject('Message from Apex!');
mail.setPlainTextBody('This is the message body11111');
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{ mail });
}*/
}
Above target Object Id and template id can be queried and set particular paraeter.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
no u cant but u can built ur own page through vf to send an email
Adding to Kiran,
Here is an example for Send Email from APEX code
Above target Object Id and template id can be queried and set particular paraeter.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.