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
ankushankush 

Need to send email to logged in user when custom button of VF page clicked

I have a command button called send on my Vf page and requirement is to send email to the logged in user who is clicking that particular button. Can some one guide me how this can be done through apex code on thtat button Please stuck on this from long time.
Best Answer chosen by ankush
Hargobind_SinghHargobind_Singh
From what I read in your problem description, this should be an easy one. You can use Apex to send email from your controller, and you can get the current user's email ID using UserInfo.getUserEmail()

Here are a few links to help you send emails from Salesforce: 

https://www.salesforce.com/docs/developer/pages/Content/pages_email_custom_controller.htm 
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_forcecom_email_outbound.htm 
https://www.salesforce.com/developer/docs/api/Content/sforce_api_calls_sendemail.htm