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
Apex Code DevelopmentApex Code Development 

Option to send an email(selected from email template lookup) in VF page in Professional Edition

Hiii Folks....

 

My requirement in Professional Edition is:

 

When I click on "New" button, a visualforce page will be opened in Edit mode.There will be some fields which need to be filled up.

 

Along with these fields there will be a lookup field of  "Email Templates" and an Email ID field.

 

I will select a particular email template from the lookup and enter one email address in Email ID field.

 

When I click on send (or) save button the content in the selected email template should be sent to the entered email address.

 

Step-wise representation of my requirement in order to get more clarity for you:

 

  • Select an email template
  • Enter an email address
  • Click on Save (or) Send button so that email will be sent to the entered email address

 

I would be thankful to you if you suggest a solution for this.

 

Regards,

Jagadeesh K.

kum09kum09

Hi,

 

Are you using a custom lookup for Email Templates?

 

Now if you have the id of the Email Template:

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            
        // Strings to hold the email addresses to which you are sending the email.  
            
        String[] toAddresses = new String[] {**** Entered Email Address *******};
        // Assign the addresses for the To and CC lists to the mail object (Optional).  
            
        mail.setToAddresses(toAddresses);
        //mail.setCcAddresses(ccAddresses);
        
        // Specify the address used when the recipients reply to the email.   
           
        mail.setReplyTo(****Reply Email*****);
        
        // Specify the name used as the display name.   
            
        mail.setSenderDisplayName(*******);
        
        // Specify the subject line for your email address.  
      
        mail.setSubject('TEST');
        mail.setBccSender(false);
        
        // Optionally append the salesforce.com email signature to the email.  
            
        // The email address of the user executing the Apex Code will be used.  
            
        mail.setUseSignature(false);
        
        // Specify the text content of the email.  
           
        mail.setHtmlBody(**** Here also u can put Template Id *****);
        
        // Send the email you have created.  
            
        Messaging.SendEmailResult[] sendEmailResults = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 

Regards,

Ckumar