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

Task - Send an eMail

Hi All


Is the "Task - Send an Email" visualforce page and underlying code exposed to be resued at all (with it's support for email templates etc etc). 






no u cant but u can built ur own page through vf  to send an email

Chamil MadusankaChamil Madusanka

Adding to Kiran,


Here is an example for Send Email from APEX code


<apex:page standardcontroller="Contact" extensions="testemail">
<apex:form >
<apex:commandButton value="Send Email!" action="{!SendEmail}"/>


public class testemail{  
  public testemail(){
    private final Contact con;
    public testemail(ApexPages.StandardController controller){
//email with pre-defined template
    public void SendEmail(){

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
      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.