You need to sign in to do that
Don't have an account?
SFDC_BigDog
Custom Button to Send an email using email template
I have created a custom button on Opportunity. The custom button has following javascript code. When the user clicks on the button the email should be sent.I find no errors in the code. But I am not able to send any emails.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} (function() { sforce.connection.sessionId = "{!$Api.Session_ID}"; var message = new sforce.SingleEmailMessage(); message.replyTo = "varunreddypenna@gmail.com,varunrp@okstate.edu"; message.targetObjectId = "{!Opportunity.Id}"; message.templateId = "00Xj0000000J8sI"; var result = sforce.connection.sendEmail([message]); if(result[0].success) { alert("I sent the email as you requested, master."); } else { alert("I had a booboo."); } }());
You need to handle exception also so that you can see exact error if anything going wrong! Try below:
hope this helps! If yes, then mark it as solution.