Thursday, 19 February 2015

Send Email using Apex and vf page by using email templates.





Hi friends,


Previously in this post I showed you how we can send emails using Messaging class, but many times we need to send email using email templates in apex code.

So in this post I am using email templates to an send email from apex code:

I am using 2 vf pages and 2 controller in this example:-

  • SendEmailByTemplateVFPage - This is the page from where we are sending Email from template.
  • ClsSendEmailByTemplate - This is controller class of "SendEmailByTemplateVFPage".
  •  SelectTemplate - This is another vf page which is calling from "SendEmailByTemplateVFPage", in this page we are querying all the Email Templates.
  • ClsSelectTemplate - This is controller class of "SelectTemplate".

Here the code:-

Screen Shots:-






Happy Coding...:)

Thanks
Anurag Jain

3 comments:

  1. Nice code Looking for this from a very long time thanks!

    ReplyDelete
  2. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information...
    free email templates

    ReplyDelete