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
naresh johnnaresh john 

Is it possible to call a visualforce email template in a visualforce page

HI every one,

 

    I created a visualforce email template in salesforce. After that I created a visualforce page, and I added a text area field in that visualforce page. Is it possible to call  that visualforce email template in to this text area. And I want to send the email when I click send button. 

 

Please provide me some info regarding this.If you need more information please let me know that.

 

Thanks,

Naresh

super developersuper developer

emailtemplate e=[select id,Name,FolderId,Subject,Description from EmailTemplate where id=:eid];

string s=e.discription;

 

After click on send compose email

 

public void sendemail(){

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setTargetObjectId(Contactid);//this is for whom  you want send email

mail.setTemplateId(e.id);

mail.setWhatId(Opportunityid); //this is which object you want with mergefields.

//if you want attach you can attach attachments

 

}

 

 

naresh johnnaresh john

Thanks alot for your great help. Can you please let me know what is eid in that first select statement.

(emailtemplate e=[select id,Name,FolderId,Subject,Description from EmailTemplate where id=:eid];)

 

 

Thanks,

Naresh

super developersuper developer

email Template Id.

naresh johnnaresh john

Thanks for the reply.

 

    Now If I click send button it immediately sends the mail. Can I specify the date and time here.Means in the specified data and time mail should be send in this context. Is it possible to do this in your code.

 

Please let me know.

 

Thanks in advance,

Naresh