How to send email from Snippet ?

edited September 1, 2016 in Questions
Hi All,

How to send emails through SNIPPET?, like Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); in salesforce.

Here I need to send HTML template, my code like this:

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();        mail.setTargetObjectId(NewContact.Id);  
mail.setTemplateId('00XD00000024V1F');     //HTML Template
mail.setOrgWideEmailAddressId(emailAddress.Id); // Email Address to send
mail.setWhatId(nominationId);   // this
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });


Please help me out.


Thank you
Shaik.

Comments

  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Sorry.  You can't put Apex in your Javascript. 

    You make a remoting call from your Javascript to an Apex function.  That is detailed here:  https://community.skuidify.com/skuid/topics/calling_apex_function


  • edited July 28, 2015
    Hi Rob, It is my Visualforce page Code, Sorry i'm not mention this line in previous post. Here my question is How we can achieve this type of mailing functionality ? We are developing Skuid page to replace Visualforce page, we are struck at this functionality Actual functionality of VF Page was "when the user click SAVE button, 1. Records creation/updation in Standard/custom object and 2. Sending an Email with template" We don't know how to achieve the second point by using snippet???????. Please help me out Thank you Shaik.
  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    I'd keep this funtion in your VF page,  and then include the Skuid page in your vf page using the <skuid:page> method.   That method is detailed in Zach's post that I linked to above.  It is option #4 in his write up. 
  • edited July 28, 2015
    Hi Rob,

    Thanks for your replay, We did sending mail  functionality :), With option#1 from Zach's post.

    Thank you


    Shaik.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!